From 295002deba8013f7ec2e4f892f664ebe5d84addb Mon Sep 17 00:00:00 2001 From: Jiang Liu Date: Sat, 28 May 2022 22:27:31 +0800 Subject: [PATCH] Clean up clippy warnings Signed-off-by: Jiang Liu --- Cargo.lock | 1067 +++++++++--------- api/src/http.rs | 2 +- blobfs/src/lib.rs | 13 +- blobfs/src/sync_io.rs | 6 +- rafs/src/fs.rs | 6 +- rafs/src/lib.rs | 2 +- rafs/src/metadata/cached_v5.rs | 4 +- rafs/src/metadata/direct_v5.rs | 10 +- rafs/src/metadata/direct_v6.rs | 8 +- rafs/src/metadata/layout/mod.rs | 2 +- rafs/src/metadata/layout/v5.rs | 27 +- rafs/src/metadata/layout/v6.rs | 7 +- rafs/src/metadata/md_v5.rs | 2 +- rafs/src/metadata/md_v6.rs | 4 +- rafs/src/metadata/mod.rs | 4 +- rafs/src/metadata/noop.rs | 7 +- rafs/src/mock/mock_inode.rs | 1 + rafs/src/mock/mock_super.rs | 9 +- src/bin/nydus-image/builder/diff.rs | 6 +- src/bin/nydus-image/builder/directory.rs | 2 +- src/bin/nydus-image/builder/stargz.rs | 9 +- src/bin/nydus-image/core/blob_compact.rs | 1 + src/bin/nydus-image/core/bootstrap.rs | 10 +- src/bin/nydus-image/core/context.rs | 3 +- src/bin/nydus-image/core/node.rs | 14 +- src/bin/nydus-image/core/tree.rs | 8 +- src/bin/nydus-image/inspect.rs | 8 +- src/bin/nydus-image/main.rs | 28 +- src/bin/nydus-image/merge.rs | 6 +- src/bin/nydus-image/trace.rs | 10 +- src/bin/nydusctl/commands.rs | 10 +- src/bin/nydusd/fusedev.rs | 2 +- src/bin/nydusd/main.rs | 18 +- storage/Cargo.toml | 1 + storage/src/backend/connection.rs | 8 +- storage/src/backend/localfs.rs | 16 +- storage/src/backend/mod.rs | 7 +- storage/src/backend/oss.rs | 3 +- storage/src/backend/registry.rs | 1 + storage/src/cache/cachedfile.rs | 2 +- storage/src/cache/filecache/mod.rs | 4 +- storage/src/cache/state/blob_state_map.rs | 80 +- storage/src/cache/state/indexed_chunk_map.rs | 24 +- storage/src/cache/worker.rs | 1 + storage/src/device.rs | 6 +- storage/src/meta/mod.rs | 29 +- storage/src/remote/connection.rs | 2 +- storage/src/remote/message.rs | 12 +- storage/src/remote/server.rs | 6 +- storage/src/test.rs | 1 + storage/src/utils.rs | 14 +- tests/builder.rs | 2 +- tests/diff.rs | 21 +- 53 files changed, 754 insertions(+), 802 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ed5d0cb6ef4..9785ef30944 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,19 +1,21 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "addr2line" -version = "0.14.1" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a55f82cfe485775d02112886f4169bde0c5894d75e79ead7eafe7e40a25e45f7" +checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" dependencies = [ "gimli", ] [[package]] name = "adler" -version = "0.2.3" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "aho-corasick" @@ -26,18 +28,18 @@ dependencies = [ [[package]] name = "ansi_term" -version = "0.11.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" +checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" dependencies = [ "winapi", ] [[package]] name = "anyhow" -version = "1.0.38" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afddf7f520a80dbf76e6f50a35bca42a2331ef227a28b3b6dc5c2e2338d114b1" +checksum = "08f9b8508dccb7687a1d6c4ce66b2b0ecef467c94667de27d8d7fe1f8d2a9cdc" [[package]] name = "arc-swap" @@ -59,9 +61,9 @@ checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" [[package]] name = "arrayvec" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4dc07131ffa69b8072d35f5007352af944213cde02545e2103680baed38fcd" +checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" [[package]] name = "assert_matches" @@ -71,29 +73,30 @@ checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" [[package]] name = "atty" -version = "0.2.11" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ + "hermit-abi", "libc", - "termion", "winapi", ] [[package]] name = "autocfg" -version = "1.0.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" -version = "0.3.55" +version = "0.3.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef5140344c85b01f9bbb4d4b7288a8aa4b3287ccef913a14bcc78a1063623598" +checksum = "11a17d453482a265fd5f8479f2a3f405566e6ca627837aaddb85af8b1ab8ef61" dependencies = [ "addr2line", - "cfg-if 1.0.0", + "cc", + "cfg-if", "libc", "miniz_oxide", "object", @@ -108,20 +111,20 @@ checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" [[package]] name = "bitflags" -version = "1.2.1" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "blake3" -version = "1.0.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcd555c66291d5f836dbb6883b48660ece810fe25a31f3bdfb911945dff2691f" +checksum = "a08e53fc5a564bb15bfe6fae56bd71522205f1f91893f9c0116edad6496c183f" dependencies = [ "arrayref", "arrayvec", "cc", - "cfg-if 1.0.0", + "cfg-if", "constant_time_eq", "digest", ] @@ -135,19 +138,19 @@ dependencies = [ "log", "nydus-app", "nydus-error", - "rafs", + "nydus-rafs", + "nydus-storage", "serde", "serde_json", "serde_with", - "storage", - "vm-memory", + "vm-memory 0.7.0", ] [[package]] name = "block-buffer" -version = "0.9.0" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324" dependencies = [ "generic-array", ] @@ -165,15 +168,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.4.0" +version = "3.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820" - -[[package]] -name = "bytes" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "130aac562c0dd69c56b3b1cc8ffd2e17be31d0b6c25b61c96b76231aa23e39e1" +checksum = "a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899" [[package]] name = "bytes" @@ -206,19 +203,13 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.54" +version = "1.0.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bbb73db36c1246e9034e307d0fba23f9a2e251faa47ade70c1bd252220c8311" +checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" dependencies = [ "jobserver", ] -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -240,9 +231,9 @@ dependencies = [ [[package]] name = "clap" -version = "2.33.1" +version = "2.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdfa80d47f954d53a35a64987ca1422f495b8d6483c0fe9f7117b36c2a792129" +checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" dependencies = [ "ansi_term", "atty", @@ -261,11 +252,11 @@ checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" [[package]] name = "core-foundation" -version = "0.9.1" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a89e2ae426ea83155dccf10c0fa6b1463ef6d5fcb44cee0b224a408fa640a62" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" dependencies = [ - "core-foundation-sys 0.8.2", + "core-foundation-sys 0.8.3", "libc", ] @@ -280,23 +271,26 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea221b5284a47e40033bf9b66f35f984ec0ea2931eb03505246cd27a963f981b" +checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" [[package]] -name = "cpuid-bool" -version = "0.1.0" +name = "cpufeatures" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d375c433320f6c5057ae04a04376eef4d04ce2801448cf8863a78da99107be4" +checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b" +dependencies = [ + "libc", +] [[package]] name = "crc32fast" -version = "1.2.0" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" dependencies = [ - "cfg-if 0.1.10", + "cfg-if", ] [[package]] @@ -305,25 +299,25 @@ version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "lazy_static", ] [[package]] -name = "crypto-mac" -version = "0.8.0" +name = "crypto-common" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" +checksum = "57952ca27b5e3606ff4dd79b0020231aaf9d6aa76dc05fd30137538c50bd3ce8" dependencies = [ "generic-array", - "subtle", + "typenum", ] [[package]] name = "darling" -version = "0.10.2" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d706e75d87e35569db781a9b5e2416cff1236a47ed380831f959382ccd5f858" +checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" dependencies = [ "darling_core", "darling_macro", @@ -331,23 +325,23 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.10.2" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0c960ae2da4de88a91b2d920c2a7233b400bc33cb28453a2987822d8392519b" +checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", - "strsim 0.9.3", + "strsim 0.10.0", "syn", ] [[package]] name = "darling_macro" -version = "0.10.2" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72" +checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" dependencies = [ "darling_core", "quote", @@ -360,7 +354,7 @@ version = "4.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e77a43b28d0668df09411cb0bc9a8c2adc40f9a048afe863e05fd43251e8e39c" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "num_cpus", ] @@ -371,16 +365,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b23c11eebec0e0814aa80b08fc43e2672d8e2c57bd006de66108ff1d2b4bfb6" dependencies = [ "libc", - "mio 0.8.2", + "mio", ] [[package]] name = "digest" -version = "0.9.0" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506" dependencies = [ - "generic-array", + "block-buffer", + "crypto-common", + "subtle", ] [[package]] @@ -395,11 +391,11 @@ dependencies = [ [[package]] name = "encoding_rs" -version = "0.8.23" +version = "0.8.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8ac63f94732332f44fe654443c46f6375d1939684c17b0afb6cb56b0456e171" +checksum = "9852635589dc9f9ea1b6fe9f05b50ef208c85c834a562f0c6abb1c475736ec2b" dependencies = [ - "cfg-if 0.1.10", + "cfg-if", ] [[package]] @@ -451,22 +447,19 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0408e2626025178a6a7f7ffc05a25bc47103229f19c113755de7bf63816290c" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", - "redox_syscall 0.2.10", + "redox_syscall", "winapi", ] [[package]] name = "flate2" -version = "1.0.17" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "766d0e77a2c1502169d4a93ff3b8c15a71fd946cd0126309752104e5f3c46d94" +checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6" dependencies = [ - "cfg-if 0.1.10", "crc32fast", - "libc", - "miniz-sys", "miniz_oxide", ] @@ -531,19 +524,19 @@ dependencies = [ "lazy_static", "libc", "log", - "mio 0.8.2", + "mio", "nix", "vhost", "virtio-queue", - "vm-memory", + "vm-memory 0.7.0", "vmm-sys-util", ] [[package]] name = "futures" -version = "0.3.12" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da9052a1a50244d8d5aa9bf55cbc2fb6f357c86cc52e46c62ed390a7180cf150" +checksum = "f73fe65f54d1e12b726f517d3e2135ca3125a437b6d998caf1962961f7172d9e" dependencies = [ "futures-channel", "futures-core", @@ -556,9 +549,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.12" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2d31b7ec7efab6eefc7c57233bb10b847986139d88cc2f5a02a1ae6871a1846" +checksum = "c3083ce4b914124575708913bca19bfe887522d6e2e6d0952943f5eac4a74010" dependencies = [ "futures-core", "futures-sink", @@ -566,15 +559,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.12" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79e5145dde8da7d1b3892dad07a9c98fc04bc39892b1ecc9692cf53e2b780a65" +checksum = "0c09fd04b7e4073ac7156a9539b57a484a8ea920f79c7c675d05d289ab6110d3" [[package]] name = "futures-executor" -version = "0.3.12" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9e59fdc009a4b3096bf94f740a0f2424c082521f20a9b08c5c07c48d90fd9b9" +checksum = "9420b90cfa29e327d0429f19be13e7ddb68fa1cccb09d65e5706b8c7a749b8a6" dependencies = [ "futures-core", "futures-task", @@ -583,17 +576,16 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.12" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28be053525281ad8259d47e4de5de657b25e7bac113458555bb4b70bc6870500" +checksum = "fc4045962a5a5e935ee2fdedaa4e08284547402885ab326734432bed5d12966b" [[package]] name = "futures-macro" -version = "0.3.12" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c287d25add322d9f9abdcdc5927ca398917996600182178774032e9f8258fedd" +checksum = "33c1e13800337f4d4d7a316bf45a567dbcb6ffe087f16424852d97e97a91f512" dependencies = [ - "proc-macro-hack", "proc-macro2", "quote", "syn", @@ -601,18 +593,15 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.12" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "caf5c69029bda2e743fddd0582d1083951d65cc9539aebf8812f36c3491342d6" +checksum = "21163e139fa306126e6eedaf49ecdb4588f939600f0b1e770f4205ee4b7fa868" [[package]] name = "futures-task" -version = "0.3.12" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13de07eb8ea81ae445aca7b69f5f7bf15d7bf4912d8ca37d6645c77ae8a58d86" -dependencies = [ - "once_cell", -] +checksum = "57c66a976bf5909d801bbef33416c41372779507e7a6b3a5e25e4749c58f776a" [[package]] name = "futures-timer" @@ -622,9 +611,9 @@ checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" [[package]] name = "futures-util" -version = "0.3.12" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "632a8cd0f2a4b3fdea1657f08bde063848c3bd00f9bbf6e256b8be78802e624b" +checksum = "d8b7abd5d659d9b90c8cba917f6ec750a74e2dc23902ef9cd4cc8c8b22e6036a" dependencies = [ "futures-channel", "futures-core", @@ -635,16 +624,14 @@ dependencies = [ "memchr", "pin-project-lite", "pin-utils", - "proc-macro-hack", - "proc-macro-nested", "slab", ] [[package]] name = "generic-array" -version = "0.14.2" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac746a5f3bbfdadd6106868134545e684693d54d9d44f6e9588a7d54af0bf980" +checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" dependencies = [ "typenum", "version_check", @@ -652,26 +639,26 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.2" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8" +checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", - "wasi 0.10.2+wasi-snapshot-preview1", + "wasi 0.10.0+wasi-snapshot-preview1", ] [[package]] name = "gimli" -version = "0.23.0" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6503fe142514ca4799d4c26297c4248239fe8838d827db6bd6065c6ed29a6ce" +checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4" [[package]] name = "git2" -version = "0.13.17" +version = "0.13.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d250f5f82326884bd39c2853577e70a121775db76818ffa452ed1e80de12986" +checksum = "f29229cc1b24c0e6062f6e742aa3e256492a5323365e5ed3413599f8a5eff7d6" dependencies = [ "bitflags", "libc", @@ -705,11 +692,11 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.11" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9f1f717ddc7b2ba36df7e871fd88db79326551d3d6f1fc406fbfd28b582ff8e" +checksum = "37a82c6d637fc9515a4694bbf1cb2457b79d81ce52b3108bdeea58b07dd34a57" dependencies = [ - "bytes 1.1.0", + "bytes", "fnv", "futures-core", "futures-sink", @@ -730,9 +717,9 @@ checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" [[package]] name = "hermit-abi" -version = "0.1.14" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9586eedd4ce6b3c498bc3b4dd92fc9f11166aa908a914071953768066c67909" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" dependencies = [ "libc", ] @@ -745,47 +732,46 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hmac" -version = "0.8.1" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "crypto-mac", "digest", ] [[package]] name = "http" -version = "0.2.1" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d569972648b2c512421b5f2a405ad6ac9666547189d0c5477a3f200f3e02f9" +checksum = "ff8670570af52249509a86f5e3e18a08c60b177071826898fde8997cf5f6bfbb" dependencies = [ - "bytes 0.5.4", + "bytes", "fnv", "itoa", ] [[package]] name = "http-body" -version = "0.4.3" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "399c583b2979440c60be0821a6199eca73bc3c8dcd9d070d75ac726e2c6186e5" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" dependencies = [ - "bytes 1.1.0", + "bytes", "http", "pin-project-lite", ] [[package]] name = "httparse" -version = "1.5.1" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acd94fdbe1d4ff688b67b04eee2e17bd50995534a61539e45adfefb45e5e5503" +checksum = "496ce29bb5a52785b44e0f7ca2847ae0bb839c9bd28f69acac9b99d461c0c04c" [[package]] name = "httpdate" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6456b8a6c8f33fee7d958fcd1b60d55b11940a79e63ae87013e6d22e26034440" +checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" [[package]] name = "humantime" @@ -795,11 +781,11 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.13" +version = "0.14.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15d1cfb9e4f68655fa04c01f59edb405b6074a0f7118ea881e5026e4a1cd8593" +checksum = "42dc3c131584288d375f2d07f822b0cb012d8c6fb899a5b9fdb3cb7eb9b6004f" dependencies = [ - "bytes 1.1.0", + "bytes", "futures-channel", "futures-core", "futures-util", @@ -823,7 +809,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ - "bytes 1.1.0", + "bytes", "hyper", "native-tls", "tokio", @@ -851,9 +837,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "idna" -version = "0.2.0" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9" +checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" dependencies = [ "matches", "unicode-bidi", @@ -862,9 +848,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.7.0" +version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5" +checksum = "e6012d540c5baa3589337a98ce73408de9b5a25ec9fc2c6fd6be8f0d39e0ca5a" dependencies = [ "autocfg", "hashbrown", @@ -872,39 +858,39 @@ dependencies = [ [[package]] name = "instant" -version = "0.1.9" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] name = "ipnet" -version = "2.3.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f2d64f2edebec4ce84ad108148e67e1064789bee435edc5b60ad398714a3a9" +checksum = "879d54834c8c76457ef4293a689b2a8c59b076067ad77b15efafbb05f92a592b" [[package]] name = "itoa" -version = "0.4.5" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e" +checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" [[package]] name = "jobserver" -version = "0.1.21" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c71313ebb9439f74b00d9d2dcec36440beaf57a6aa0623068441dd7cd81a7f2" +checksum = "af25a77299a7f711a01975c35a6a424eb6862092cc2d6c72c4ed6cbc56dfc1fa" dependencies = [ "libc", ] [[package]] name = "js-sys" -version = "0.3.55" +version = "0.3.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cc9ffccd38c451a86bf13657df244e9c3f37493cce8e5e21e940963777acc84" +checksum = "671a26f820db17c2a2750743f1dd03bafd15b98c9f30c7c2628c024c05d73397" dependencies = [ "wasm-bindgen", ] @@ -917,15 +903,15 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.119" +version = "0.2.126" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bf2e165bb3457c8e098ea76f3e3bc9db55f87aa90d52d0e6be741470916aaa4" +checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" [[package]] name = "libgit2-sys" -version = "0.12.18+1.1.0" +version = "0.12.26+1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3da6a42da88fc37ee1ecda212ffa254c25713532980005d5f7c0b0fbe7e6e885" +checksum = "19e1c899248e606fbfe68dcb31d8b0176ebab833b103824af31bddf4b7457494" dependencies = [ "cc", "libc", @@ -935,9 +921,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.2" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "602113192b08db8f38796c4e85c39e960c145965140e918018bcde1952429655" +checksum = "9702761c3935f8cc2f101793272e202c72b99da8f4224a19ddcf1279a6450bbf" dependencies = [ "cc", "libc", @@ -947,27 +933,28 @@ dependencies = [ [[package]] name = "lock_api" -version = "0.4.2" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd96ffd135b2fd7b973ac026d28085defbe8983df057ced3eb4f2130b0831312" +checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" dependencies = [ + "autocfg", "scopeguard", ] [[package]] name = "log" -version = "0.4.14" +version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] name = "lz4-sys" -version = "1.9.2" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dca79aa95d8b3226213ad454d328369853be3a1382d89532a854f4d69640acae" +checksum = "d7be8908e2ed6f31c02db8a9fa962f03e36c53fbfde437363eae3306b85d7e17" dependencies = [ "cc", "libc", @@ -984,21 +971,21 @@ dependencies = [ [[package]] name = "matches" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" +checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" [[package]] name = "memchr" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memoffset" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59accc507f1338036a0477ef61afdae33cde60840f4dfe481319ce3ad116ddf9" +checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" dependencies = [ "autocfg", ] @@ -1009,66 +996,32 @@ version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" -[[package]] -name = "miniz-sys" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e9e3ae51cea1576ceba0dde3d484d30e6e5b86dee0b2d412fe3a16a15c98202" -dependencies = [ - "cc", - "libc", -] - [[package]] name = "miniz_oxide" -version = "0.4.1" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d7559a8a40d0f97e1edea3220f698f78b1c5ab67532e49f68fde3910323b722" +checksum = "d2b29bd4bc3f33391105ebee3589c19197c4271e3e5a9ec9bfe8127eeff8f082" dependencies = [ "adler", ] [[package]] name = "mio" -version = "0.7.13" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c2bdb6314ec10835cd3293dd268473a835c02b7b352e788be788b3c6ca6bb16" +checksum = "713d550d9b44d89174e066b7a6217ae06234c10cb47819a88290d2b353c31799" dependencies = [ "libc", "log", - "miow", - "ntapi", - "winapi", -] - -[[package]] -name = "mio" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52da4364ffb0e4fe33a9841a98a3f3014fb964045ce4f7a45a398243c8d6b0c9" -dependencies = [ - "libc", - "log", - "miow", - "ntapi", "wasi 0.11.0+wasi-snapshot-preview1", - "winapi", -] - -[[package]] -name = "miow" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" -dependencies = [ - "winapi", + "windows-sys", ] [[package]] name = "native-tls" -version = "0.2.8" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48ba9f7719b5a0f42f338907614285fb5fd70e53858141f69898a1fb7203b24d" +checksum = "fd7e2f3618557f980e0b17e8856252eee3c97fa12c54dff0ca290fb6266ca4a9" dependencies = [ "lazy_static", "libc", @@ -1090,7 +1043,7 @@ checksum = "9f866317acbd3a240710c63f065ffb1e4fd466259045ccb504130b7f668f35c6" dependencies = [ "bitflags", "cc", - "cfg-if 1.0.0", + "cfg-if", "libc", "memoffset", ] @@ -1107,20 +1060,11 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38bf9645c8b145698bb0b18a4637dcacbc421ea49bef2317e4fd8065a387cf21" -[[package]] -name = "ntapi" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a31937dea023539c72ddae0e3571deadc1414b300483fa7aaec176168cfa9d2" -dependencies = [ - "winapi", -] - [[package]] name = "num-integer" -version = "0.1.42" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f6ea62e9d81a77cd3ee9a2a5b9b609447857f3d358704331e4ef39eb247fcba" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" dependencies = [ "autocfg", "num-traits", @@ -1128,29 +1072,23 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" +checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" dependencies = [ "autocfg", ] [[package]] name = "num_cpus" -version = "1.13.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" +checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" dependencies = [ "hermit-abi", "libc", ] -[[package]] -name = "numtoa" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" - [[package]] name = "nydus-api" version = "0.1.0" @@ -1159,7 +1097,7 @@ dependencies = [ "http", "lazy_static", "log", - "mio 0.8.2", + "mio", "nydus-utils", "serde", "serde_derive", @@ -1184,7 +1122,7 @@ dependencies = [ [[package]] name = "nydus-error" -version = "0.2.0" +version = "0.2.1" dependencies = [ "backtrace", "httpdate", @@ -1194,6 +1132,39 @@ dependencies = [ "serde_json", ] +[[package]] +name = "nydus-rafs" +version = "0.1.0" +dependencies = [ + "anyhow", + "arc-swap 0.4.8", + "assert_matches", + "base64", + "bitflags", + "blake3", + "flate2", + "fuse-backend-rs", + "futures", + "hmac", + "lazy_static", + "libc", + "log", + "lz4-sys", + "nix", + "nydus-error", + "nydus-storage", + "nydus-utils", + "serde", + "serde_json", + "serde_with", + "sha-1", + "sha2", + "spmc", + "url", + "vm-memory 0.7.0", + "vmm-sys-util", +] + [[package]] name = "nydus-rs" version = "2.0.0" @@ -1211,14 +1182,15 @@ dependencies = [ "lazy_static", "libc", "log", - "mio 0.8.2", + "mio", "nix", "nydus-api", "nydus-app", "nydus-error", + "nydus-rafs", + "nydus-storage", "nydus-utils", "openssl", - "rafs", "rand", "rand_core", "regex", @@ -1229,21 +1201,53 @@ dependencies = [ "serde_json", "serde_with", "sha2", - "storage", "tar", "tokio", "vhost", "vhost-user-backend", "virtio-bindings", "virtio-queue", - "vm-memory", + "vm-memory 0.7.0", "vmm-sys-util", "xattr", ] +[[package]] +name = "nydus-storage" +version = "0.5.0" +dependencies = [ + "anyhow", + "arc-swap 0.4.8", + "base64", + "bitflags", + "dbs-uhttp", + "fuse-backend-rs", + "futures", + "governor", + "hmac", + "httpdate", + "lazy_static", + "libc", + "log", + "nix", + "nydus-error", + "nydus-utils", + "reqwest", + "serde", + "serde_json", + "serde_with", + "sha-1", + "sha2", + "spmc", + "tokio", + "url", + "vm-memory 0.7.0", + "vmm-sys-util", +] + [[package]] name = "nydus-utils" -version = "0.1.0" +version = "0.2.1" dependencies = [ "blake3", "flate2", @@ -1262,56 +1266,65 @@ dependencies = [ [[package]] name = "object" -version = "0.22.0" +version = "0.28.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d3b63360ec3cb337817c2dbd47ab4a0f170d285d8e5a2064600f3def1402397" +checksum = "e42c982f2d955fac81dd7e1d0e1426a7d702acd9c98d19ab01083a6a0328c424" +dependencies = [ + "memchr", +] [[package]] name = "once_cell" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56" - -[[package]] -name = "opaque-debug" -version = "0.3.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" +checksum = "7709cef83f0c1f58f666e746a08b21e0085f7440fa6a29cc194d68aac97a4225" [[package]] name = "openssl" -version = "0.10.38" +version = "0.10.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c7ae222234c30df141154f159066c5093ff73b63204dcda7121eb082fc56a95" +checksum = "fb81a6430ac911acb25fe5ac8f1d2af1b4ea8a4fdfda0f1ee4292af2e2d8eb0e" dependencies = [ "bitflags", - "cfg-if 1.0.0", + "cfg-if", "foreign-types", "libc", "once_cell", + "openssl-macros", "openssl-sys", ] +[[package]] +name = "openssl-macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "openssl-probe" -version = "0.1.2" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-src" -version = "111.18.0+1.1.1n" +version = "111.20.0+1.1.1o" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7897a926e1e8d00219127dc020130eca4292e5ca666dd592480d72c3eca2ff6c" +checksum = "92892c4f87d56e376e469ace79f1128fdaded07646ddf73aa0be4706ff712dec" dependencies = [ "cc", ] [[package]] name = "openssl-sys" -version = "0.9.72" +version = "0.9.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e46109c383602735fa0a2e48dd2b7c892b048e1bf69e5c3b1d804b7d9c203cb" +checksum = "9d5fd19fb3e0a8191c1e34935718976a3e70c112ab9a24af6d7cadccd9d90bc0" dependencies = [ "autocfg", "cc", @@ -1323,9 +1336,9 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.11.1" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" dependencies = [ "instant", "lock_api", @@ -1334,14 +1347,14 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.8.2" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ccb628cad4f84851442432c60ad8e1f607e29752d0bf072cbd0baf28aa34272" +checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "instant", "libc", - "redox_syscall 0.1.56", + "redox_syscall", "smallvec", "winapi", ] @@ -1354,18 +1367,18 @@ checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" [[package]] name = "pin-project" -version = "1.0.8" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "576bc800220cc65dac09e99e97b08b358cfab6e17078de8dc5fee223bd2d0c08" +checksum = "58ad3879ad3baf4e44784bc6a718a8698867bb991f8ce24d1bcbe2cfb4c3a75e" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.0.8" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e8fe8163d14ce7f0cdac2e040116f22eac817edabff0be91e8aff7e9accf389" +checksum = "744b6f092ba29c3650faf274db506afd39944f48420f6c86b17cfe0ee1cb36bb" dependencies = [ "proc-macro2", "quote", @@ -1374,9 +1387,9 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.4" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439697af366c49a6d0a010c56a0d97685bc140ce0d377b13a2ea2aa42d64a827" +checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" [[package]] name = "pin-utils" @@ -1386,35 +1399,23 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.17" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677" +checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" [[package]] name = "ppv-lite86" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "237a5ed80e274dbc66f86bd59c1e25edc039660be53194b5fe0a482e0f2612ea" - -[[package]] -name = "proc-macro-hack" -version = "0.5.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" - -[[package]] -name = "proc-macro-nested" -version = "0.1.7" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" +checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" [[package]] name = "proc-macro2" -version = "1.0.29" +version = "1.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9f5105d4fdaab20335ca9565e106a5d9b82b6219b5ba735731124ac6711d23d" +checksum = "c54b25569025b7fc9651de43004ae593a75ad88543b17178aa5e1b9c4f15f56f" dependencies = [ - "unicode-xid", + "unicode-ident", ] [[package]] @@ -1428,53 +1429,20 @@ dependencies = [ "mach", "once_cell", "raw-cpuid", - "wasi 0.10.2+wasi-snapshot-preview1", + "wasi 0.10.0+wasi-snapshot-preview1", "web-sys", "winapi", ] [[package]] name = "quote" -version = "1.0.6" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54a21852a652ad6f610c9510194f398ff6f8692e334fd1145fed931f7fbe44ea" +checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1" dependencies = [ "proc-macro2", ] -[[package]] -name = "rafs" -version = "0.1.0" -dependencies = [ - "anyhow", - "arc-swap 0.4.8", - "assert_matches", - "base64", - "bitflags", - "blake3", - "flate2", - "fuse-backend-rs", - "futures", - "hmac", - "lazy_static", - "libc", - "log", - "lz4-sys", - "nix", - "nydus-error", - "nydus-utils", - "serde", - "serde_json", - "serde_with", - "sha-1", - "sha2", - "spmc", - "storage", - "url", - "vm-memory", - "vmm-sys-util", -] - [[package]] name = "rand" version = "0.8.5" @@ -1488,9 +1456,9 @@ dependencies = [ [[package]] name = "rand_chacha" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", "rand_core", @@ -1498,51 +1466,36 @@ dependencies = [ [[package]] name = "rand_core" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7" +checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" dependencies = [ "getrandom", ] [[package]] name = "raw-cpuid" -version = "10.2.0" +version = "10.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "929f54e29691d4e6a9cc558479de70db7aa3d98cd6fe7ab86d7507aa2886b9d2" +checksum = "738bc47119e3eeccc7e94c4a506901aea5e7b4944ecd0829cbebf4af04ceda12" dependencies = [ "bitflags", ] [[package]] name = "redox_syscall" -version = "0.1.56" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" - -[[package]] -name = "redox_syscall" -version = "0.2.10" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff" +checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" dependencies = [ "bitflags", ] -[[package]] -name = "redox_termios" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" -dependencies = [ - "redox_syscall 0.1.56", -] - [[package]] name = "regex" -version = "1.5.5" +version = "1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286" +checksum = "d83f127d94bdbcda4c8cc2e50f6f84f4b611f69c902699ca385a39c3a75f9ff1" dependencies = [ "aho-corasick", "memchr", @@ -1551,9 +1504,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.25" +version = "0.6.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" +checksum = "49b3de9ec5dc0a3417da371aab17d729997c15010e7fd24ff707773a33bddb64" [[package]] name = "remove_dir_all" @@ -1566,12 +1519,12 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.9" +version = "0.11.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f242f1488a539a79bac6dbe7c8609ae43b7914b7736210f239a37cccb32525" +checksum = "46a1f7aa4f35e5e8b4160449f51afc758f0ce6454315a9fa7d0d113e958c41eb" dependencies = [ "base64", - "bytes 1.1.0", + "bytes", "encoding_rs", "futures-core", "futures-util", @@ -1602,11 +1555,10 @@ dependencies = [ [[package]] name = "rlimit" -version = "0.3.0" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d26e65e82a1e2628c5f209ec12f4508fa50e644bd2f264138e60129d61eae8" +checksum = "f7278a1ec8bfd4a4e07515c589f5ff7b309a373f987393aef44813d9dcf87aa3" dependencies = [ - "cfg-if 0.1.10", "libc", ] @@ -1631,24 +1583,24 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.16" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" +checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" [[package]] name = "ryu" -version = "1.0.4" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed3d612bc64430efeb3f7ee6ef26d590dce0c43249217bddc62112540c7941e1" +checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" [[package]] name = "schannel" -version = "0.1.19" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" +checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2" dependencies = [ "lazy_static", - "winapi", + "windows-sys", ] [[package]] @@ -1659,24 +1611,24 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "security-framework" -version = "2.3.1" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23a2ac85147a3a11d77ecf1bc7166ec0b92febfa4461c37944e180f319ece467" +checksum = "2dc14f172faf8a0194a3aded622712b0de276821addc574fa54fc0a1167e10dc" dependencies = [ "bitflags", "core-foundation", - "core-foundation-sys 0.8.2", + "core-foundation-sys 0.8.3", "libc", "security-framework-sys", ] [[package]] name = "security-framework-sys" -version = "2.4.2" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9dd14d83160b528b7bfd66439110573efcfbe281b17fc2ca9f39f550d619c7e" +checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556" dependencies = [ - "core-foundation-sys 0.8.2", + "core-foundation-sys 0.8.3", "libc", ] @@ -1707,18 +1659,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.110" +version = "1.0.137" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99e7b308464d16b56eba9964e4972a3eee817760ab60d88c3f86e1fecb08204c" +checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.110" +version = "1.0.137" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "818fbf6bfa9a42d3bfcaca148547aa00c7b915bec71d1757aa2d44ca68771984" +checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be" dependencies = [ "proc-macro2", "quote", @@ -1727,9 +1679,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.53" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "993948e75b189211a9b31a7528f950c6adc21f9720b6438ff80a7fa2f864cea2" +checksum = "9b7ce2b32a1aed03c558dc61a5cd328f15aff2dbc17daad8fb8af04d2100e15c" dependencies = [ "itoa", "ryu", @@ -1738,9 +1690,9 @@ dependencies = [ [[package]] name = "serde_urlencoded" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edfa57a7f8d9c1d260a549e7224100f6c43d43f9103e06dd8b4095a9b2b43ce9" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" dependencies = [ "form_urlencoded", "itoa", @@ -1750,9 +1702,9 @@ dependencies = [ [[package]] name = "serde_with" -version = "1.6.1" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "012c1e1750318ba7d775e4104e34a4eca896b0016e6b90370f12381a28fb29f0" +checksum = "678b5a069e50bf00ecd22d0cd8ddf7c236f68581b03db652061ed5eb13a312ff" dependencies = [ "serde", "serde_with_macros", @@ -1760,9 +1712,9 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "1.3.0" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1197ff7de45494f290c1e3e1a6f80e108974681984c87a3e480991ef3d0f1950" +checksum = "e182d6ec6f05393cc0e5ed1bf81ad6db3a8feedf8ee515ecdd369809bcce8082" dependencies = [ "darling", "proc-macro2", @@ -1772,47 +1724,43 @@ dependencies = [ [[package]] name = "sha-1" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "170a36ea86c864a3f16dd2687712dd6646f7019f301e57537c7f4dc9f5916770" +checksum = "028f48d513f9678cda28f6e4064755b3fbb2af6acd672f2c209b62323f7aea0f" dependencies = [ - "block-buffer", - "cfg-if 0.1.10", - "cpuid-bool", + "cfg-if", + "cpufeatures", "digest", - "opaque-debug", ] [[package]] name = "sha2" -version = "0.9.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2933378ddfeda7ea26f48c555bdad8bb446bf8a3d17832dc83e380d444cfb8c1" +checksum = "55deaec60f81eefe3cce0dc50bda92d6d8e88f2a27df7c5033b42afeb1ed2676" dependencies = [ - "block-buffer", - "cfg-if 0.1.10", - "cpuid-bool", + "cfg-if", + "cpufeatures", "digest", - "opaque-debug", ] [[package]] name = "slab" -version = "0.4.2" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" +checksum = "eb703cfe953bccee95685111adeedb76fabe4e97549a58d16f03ea7b9367bb32" [[package]] name = "smallvec" -version = "1.6.1" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" +checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" [[package]] name = "socket2" -version = "0.4.2" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dc90fe6c7be1a323296982db1836d1ea9e47b6839496dde9a541bc496df3516" +checksum = "66d72b759436ae32898a2af0a14218dbf55efde3feeb170eb623637db85ee1e0" dependencies = [ "libc", "winapi", @@ -1824,39 +1772,6 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "02a8428da277a8e3a15271d79943e80ccc2ef254e78813a166a08d65e4c3ece5" -[[package]] -name = "storage" -version = "0.5.0" -dependencies = [ - "anyhow", - "arc-swap 0.4.8", - "base64", - "bitflags", - "dbs-uhttp", - "fuse-backend-rs", - "futures", - "governor", - "hmac", - "httpdate", - "lazy_static", - "libc", - "log", - "nix", - "nydus-error", - "nydus-utils", - "reqwest", - "serde", - "serde_json", - "serde_with", - "sha-1", - "sha2", - "spmc", - "tokio", - "url", - "vm-memory", - "vmm-sys-util", -] - [[package]] name = "strsim" version = "0.8.0" @@ -1865,25 +1780,25 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "strsim" -version = "0.9.3" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "subtle" -version = "2.2.3" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "502d53007c02d7605a05df1c1a73ee436952781653da5d0bf57ad608f66932c1" +checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "syn" -version = "1.0.76" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6f107db402c2c2055242dbf4d2af0e69197202e9faacbef9571bbe47f5a1b84" +checksum = "fbaf6116ab8924f39d52792136fb74fd60a80194cf1b1c6ffa6453eef1c3f942" dependencies = [ "proc-macro2", "quote", - "unicode-xid", + "unicode-ident", ] [[package]] @@ -1903,35 +1818,23 @@ version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "fastrand", "libc", - "redox_syscall 0.2.10", + "redox_syscall", "remove_dir_all", "winapi", ] [[package]] name = "termcolor" -version = "1.1.0" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb6bfa289a4d7c5766392812c0a1f4c1ba45afa1ad47803c11e1f407d846d75f" +checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" dependencies = [ "winapi-util", ] -[[package]] -name = "termion" -version = "1.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c22cec9d8978d906be5ac94bceb5a010d885c626c4c8855721a4dbd20e3ac905" -dependencies = [ - "libc", - "numtoa", - "redox_syscall 0.1.56", - "redox_termios", -] - [[package]] name = "textwrap" version = "0.11.0" @@ -1943,18 +1846,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.21" +version = "1.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "318234ffa22e0920fe9a40d7b8369b5f649d490980cf7aadcf1eb91594869b42" +checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.21" +version = "1.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cae2447b6282786c3493999f40a9be2a6ad20cb8bd268b0a0dbf5a065535c0ab" +checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" dependencies = [ "proc-macro2", "quote", @@ -1963,26 +1866,44 @@ dependencies = [ [[package]] name = "time" -version = "0.1.43" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" +checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" dependencies = [ "libc", + "wasi 0.10.0+wasi-snapshot-preview1", "winapi", ] +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" + [[package]] name = "tokio" -version = "1.16.1" +version = "1.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c27a64b625de6d309e8c57716ba93021dccf1b3b5c97edd6d3dd2d2135afc0a" +checksum = "4903bf0427cf68dddd5aa6a93220756f8be0c34fcfa9f5e6191e103e15a31395" dependencies = [ - "bytes 1.1.0", + "bytes", "libc", "memchr", - "mio 0.7.13", + "mio", "num_cpus", + "once_cell", "pin-project-lite", + "socket2", "tokio-macros", "winapi", ] @@ -2010,94 +1931,103 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.6.8" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d3725d3efa29485e87311c5b699de63cde14b00ed4d256b8318aa30ca452cd" +checksum = "f988a1a1adc2fb21f9c12aa96441da33a1728193ae0b95d2be22dbd17fcb4e5c" dependencies = [ - "bytes 1.1.0", + "bytes", "futures-core", "futures-sink", - "log", "pin-project-lite", "tokio", + "tracing", ] [[package]] name = "toml" -version = "0.5.8" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" +checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" dependencies = [ "serde", ] [[package]] name = "tower-service" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860" +checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" [[package]] name = "tracing" -version = "0.1.27" +version = "0.1.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2ba9ab62b7d6497a8638dfda5e5c4fb3b2d5a7fca4118f2b96151c8ef1a437e" +checksum = "5d0ecdcb44a79f0fe9844f0c4f33a342cbcbb5117de8001e6ba0dc2351327d09" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "pin-project-lite", + "tracing-attributes", "tracing-core", ] +[[package]] +name = "tracing-attributes" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc6b8ad3567499f98a1db7a752b07a7c8c7c7c34c332ec00effb2b0027974b7c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "tracing-core" -version = "0.1.20" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46125608c26121c81b0c6d693eab5a420e416da7e43c426d2e8f7df8da8a3acf" +checksum = "f54c8ca710e81886d498c2fd3331b56c93aa248d49de2222ad2742247c60072f" dependencies = [ "lazy_static", ] [[package]] name = "try-lock" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382" +checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" [[package]] name = "typenum" -version = "1.12.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" +checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" [[package]] name = "unicode-bidi" -version = "0.3.4" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" -dependencies = [ - "matches", -] +checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" + +[[package]] +name = "unicode-ident" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d22af068fba1eb5edcb4aea19d382b2a3deb4c8f9d475c589b6ada9e0fd493ee" [[package]] name = "unicode-normalization" -version = "0.1.12" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5479532badd04e128284890390c1e876ef7a993d0570b3597ae43dfa1d59afa4" +checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" dependencies = [ - "smallvec", + "tinyvec", ] [[package]] name = "unicode-width" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479" - -[[package]] -name = "unicode-xid" -version = "0.2.0" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" +checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" [[package]] name = "url" @@ -2113,9 +2043,9 @@ dependencies = [ [[package]] name = "vcpkg" -version = "0.2.10" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6454029bf181f092ad1b853286f23e2c507d8e8194d01d92da4a55c274a5508c" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "vec_map" @@ -2125,9 +2055,9 @@ checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" [[package]] name = "version_check" -version = "0.9.2" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "vhost" @@ -2137,7 +2067,7 @@ checksum = "3b56bf8f178fc500fe14505fca8b00dec76fc38f2304f461c8d9d7547982311d" dependencies = [ "bitflags", "libc", - "vm-memory", + "vm-memory 0.8.0", "vmm-sys-util", ] @@ -2152,7 +2082,7 @@ dependencies = [ "vhost", "virtio-bindings", "virtio-queue", - "vm-memory", + "vm-memory 0.7.0", "vmm-sys-util", ] @@ -2169,7 +2099,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f90da9e627f6aaf667cc7b6548a28be332d3e1f058f4ceeb46ab6bcee5c4b74d" dependencies = [ "log", - "vm-memory", + "vm-memory 0.7.0", "vmm-sys-util", ] @@ -2184,6 +2114,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "vm-memory" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "767ed8aaebbff902e02e6d3749dc2baef55e46565f8a6414a065e5baee4b4a81" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "vmm-sys-util" version = "0.9.0" @@ -2206,9 +2146,9 @@ dependencies = [ [[package]] name = "wasi" -version = "0.10.2+wasi-snapshot-preview1" +version = "0.10.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" +checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" [[package]] name = "wasi" @@ -2218,19 +2158,19 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.78" +version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "632f73e236b219150ea279196e54e610f5dbafa5d61786303d4da54f84e47fce" +checksum = "27370197c907c55e3f1a9fbe26f44e937fe6451368324e009cba39e139dc08ad" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.78" +version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a317bf8f9fba2476b4b2c85ef4c4af8ff39c3c7f0cdfeed4f82c34a880aa837b" +checksum = "53e04185bfa3a779273da532f5025e33398409573f348985af9a1cbf3774d3f4" dependencies = [ "bumpalo", "lazy_static", @@ -2243,11 +2183,11 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.28" +version = "0.4.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e8d7523cb1f2a4c96c1317ca690031b714a51cc14e05f712446691f413f5d39" +checksum = "6f741de44b75e14c35df886aff5f1eb73aa114fa5d4d00dcd37b5e01259bf3b2" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "js-sys", "wasm-bindgen", "web-sys", @@ -2255,9 +2195,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.78" +version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d56146e7c495528bf6587663bea13a8eb588d39b36b679d83972e1a2dbbdacf9" +checksum = "17cae7ff784d7e83a2fe7611cfe766ecf034111b49deb850a3dc7699c08251f5" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2265,9 +2205,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.78" +version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7803e0eea25835f8abdc585cd3021b3deb11543c6fe226dcd30b228857c5c5ab" +checksum = "99ec0dc7a4756fffc231aab1b9f2f578d23cd391390ab27f952ae0c9b3ece20b" dependencies = [ "proc-macro2", "quote", @@ -2278,15 +2218,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.78" +version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0237232789cf037d5480773fe568aac745bfe2afbc11a863e97901780a6b47cc" +checksum = "d554b7f530dee5964d9a9468d95c1f8b8acae4f282807e7d27d4b03099a46744" [[package]] name = "web-sys" -version = "0.3.41" +version = "0.3.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "863539788676619aac1a23e2df3655e96b32b0e05eb72ca34ba045ad573c625d" +checksum = "7b17e741662c70c8bd24ac5c5b18de314a2c26c32bf8346ee1e6f53de919c283" dependencies = [ "js-sys", "wasm-bindgen", @@ -2323,44 +2263,87 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-sys" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" +dependencies = [ + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" + +[[package]] +name = "windows_i686_gnu" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" + +[[package]] +name = "windows_i686_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" + [[package]] name = "winreg" -version = "0.7.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69" +checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" dependencies = [ "winapi", ] [[package]] name = "xattr" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" +checksum = "6d1526bbe5aaeb5eb06885f4d987bcdfa5e23187055de9b83fe00156a821fabc" dependencies = [ "libc", ] [[package]] name = "yansi" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fc79f4a1e39857fc00c3f662cbf2651c771f00e9c15fe2abc341806bd46bd71" +checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" [[package]] name = "zstd" -version = "0.11.1+zstd.1.5.2" +version = "0.11.2+zstd.1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a16b8414fde0414e90c612eba70985577451c4c504b99885ebed24762cb81a" +checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" dependencies = [ "zstd-safe", ] [[package]] name = "zstd-safe" -version = "5.0.1+zstd.1.5.2" +version = "5.0.2+zstd.1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c12659121420dd6365c5c3de4901f97145b79651fb1d25814020ed2ed0585ae" +checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" dependencies = [ "libc", "zstd-sys", diff --git a/api/src/http.rs b/api/src/http.rs index 0e5f9a7b48c..277e1d9ffd1 100644 --- a/api/src/http.rs +++ b/api/src/http.rs @@ -479,7 +479,7 @@ fn handle_http_request( let mut response = match uri_parsed { Ok(uri) => match HTTP_ROUTES.routes.get(uri.path()) { Some(route) => route - .handle_request(&request, &|r| { + .handle_request(request, &|r| { kick_api_server(api_notifier.clone(), to_api, from_api, r) }) .unwrap_or_else(|err| error_response(err, StatusCode::BadRequest)), diff --git a/blobfs/src/lib.rs b/blobfs/src/lib.rs index af90386163f..96a3f815d0e 100644 --- a/blobfs/src/lib.rs +++ b/blobfs/src/lib.rs @@ -45,7 +45,7 @@ use std::sync::{Arc, Mutex}; use std::thread; #[cfg(feature = "virtiofs")] -use storage::device::BlobPrefetchRequest; +use nydus_storage::device::BlobPrefetchRequest; use vm_memory::ByteValued; mod sync_io; @@ -94,7 +94,7 @@ impl FromStr for BlobOndemandConfig { } /// Options that configure the behavior of the blobfs fuse file system. -#[derive(Debug, Clone, PartialEq)] +#[derive(Default, Debug, Clone, PartialEq)] pub struct Config { /// Blobfs config is embedded with passthrough config pub ps_config: PassthroughConfig, @@ -102,15 +102,6 @@ pub struct Config { pub blob_ondemand_cfg: String, } -impl Default for Config { - fn default() -> Self { - Config { - ps_config: PassthroughConfig::default(), - blob_ondemand_cfg: Default::default(), - } - } -} - #[allow(dead_code)] struct RafsHandle { rafs: Arc>>, diff --git a/blobfs/src/sync_io.rs b/blobfs/src/sync_io.rs index 40146ee2a4e..16f4019773c 100644 --- a/blobfs/src/sync_io.rs +++ b/blobfs/src/sync_io.rs @@ -13,14 +13,14 @@ use fuse_backend_rs::api::CreateIn; use fuse_backend_rs::transport::FsCacheReqHandler; use nydus_error::eacces; #[cfg(feature = "virtiofs")] +use nydus_storage::device::BlobPrefetchRequest; +#[cfg(feature = "virtiofs")] use std::cmp::min; use std::ffi::CStr; use std::io; #[cfg(feature = "virtiofs")] use std::path::Path; use std::time::Duration; -#[cfg(feature = "virtiofs")] -use storage::device::BlobPrefetchRequest; impl BlobFs { #[cfg(feature = "virtiofs")] @@ -50,7 +50,7 @@ impl BlobFs { let blob_file = Self::open_file( libc::AT_FDCWD, - &blob_id_full_path.as_path(), + blob_id_full_path.as_path(), libc::O_PATH | libc::O_NOFOLLOW | libc::O_CLOEXEC, 0, ) diff --git a/rafs/src/fs.rs b/rafs/src/fs.rs index 8126f5613e8..1ac3a5ee851 100644 --- a/rafs/src/fs.rs +++ b/rafs/src/fs.rs @@ -131,9 +131,9 @@ macro_rules! trim_backend_config { ($config:expr, $($i:expr),*) => { let mut _n :&mut serde_json::Value = &mut $config["device"]["backend"]["config"]; if let serde_json::Value::Object(ref mut m) = _n { - $(if m.contains_key($i) { m[$i].take();} else {()};)* + $(if m.contains_key($i) { m[$i].take();} )* } - }; + } } /// Rafs storage backend configuration information. @@ -1029,7 +1029,7 @@ pub(crate) mod tests { #[test] fn it_should_enable_xattr() { let rafs = new_rafs_backend(); - assert_eq!(rafs.xattr_supported(), true); + assert!(rafs.xattr_supported()); } #[test] diff --git a/rafs/src/lib.rs b/rafs/src/lib.rs index 92e9738b687..7a1d9b38f56 100644 --- a/rafs/src/lib.rs +++ b/rafs/src/lib.rs @@ -75,7 +75,7 @@ impl std::error::Error for RafsError { impl Display for RafsError { fn fmt(&self, f: &mut Formatter) -> FmtResult { - write!(f, "{}", format!("{:?}", self))?; + write!(f, "{:?}", self)?; Ok(()) } } diff --git a/rafs/src/metadata/cached_v5.rs b/rafs/src/metadata/cached_v5.rs index c214aaa6219..6a40cba4b2c 100644 --- a/rafs/src/metadata/cached_v5.rs +++ b/rafs/src/metadata/cached_v5.rs @@ -846,7 +846,7 @@ mod cached_tests { assert_eq!(cached_chunk.uncompress_offset(), 0); let c_xattr = cached_inode.get_xattrs().unwrap(); for k in c_xattr.iter() { - let k = OsStr::from_bytes(&k); + let k = OsStr::from_bytes(k); let v = cached_inode.get_xattr(k).unwrap(); assert_eq!(xattr.get(k).cloned().unwrap(), v.unwrap()); } @@ -990,7 +990,7 @@ mod cached_tests { assert_eq!(sb.max_inode, RAFS_ROOT_INODE); assert_eq!(sb.s_inodes.len(), 0); - assert_eq!(sb.validate_digest, true); + assert!(sb.validate_digest); let mut inode = CachedInodeV5::new(sb.s_blob.clone(), sb.s_meta.clone()); inode.i_ino = 1; diff --git a/rafs/src/metadata/direct_v5.rs b/rafs/src/metadata/direct_v5.rs index c58f498fecc..d2dbbce0308 100644 --- a/rafs/src/metadata/direct_v5.rs +++ b/rafs/src/metadata/direct_v5.rs @@ -108,6 +108,11 @@ struct DirectMappingState { validate_digest: bool, } +// Safe to Send/Sync because the underlying data structures are readonly +unsafe impl Send for DirectMappingState {} + +unsafe impl Sync for DirectMappingState {} + impl DirectMappingState { fn new(meta: &RafsSuperMeta, validate_digest: bool) -> Self { DirectMappingState { @@ -180,11 +185,6 @@ pub struct DirectSuperBlockV5 { state: ArcSwap, } -// Safe to Send/Sync because the underlying data structures are readonly -unsafe impl Send for DirectSuperBlockV5 {} - -unsafe impl Sync for DirectSuperBlockV5 {} - impl DirectSuperBlockV5 { /// Create a new instance of `DirectSuperBlockV5`. pub fn new(meta: &RafsSuperMeta, validate_digest: bool) -> Self { diff --git a/rafs/src/metadata/direct_v6.rs b/rafs/src/metadata/direct_v6.rs index 8ff7e40b70b..6714feda5e2 100644 --- a/rafs/src/metadata/direct_v6.rs +++ b/rafs/src/metadata/direct_v6.rs @@ -61,10 +61,6 @@ use storage::device::{ }; use storage::utils::readahead; -// Safe to Send/Sync because the underlying data structures are readonly -unsafe impl Send for DirectSuperBlockV6 {} -unsafe impl Sync for DirectSuperBlockV6 {} - fn err_invalidate_data(rafs_err: RafsError) -> std::io::Error { std::io::Error::new(std::io::ErrorKind::InvalidData, rafs_err) } @@ -86,6 +82,10 @@ struct DirectMappingState { validate_digest: bool, } +// Safe to Send/Sync because the underlying data structures are readonly +unsafe impl Send for DirectMappingState {} +unsafe impl Sync for DirectMappingState {} + impl DirectMappingState { fn new(meta: &RafsSuperMeta, validate_digest: bool) -> Self { DirectMappingState { diff --git a/rafs/src/metadata/layout/mod.rs b/rafs/src/metadata/layout/mod.rs index 690abe3dd0e..9e9969d1231 100644 --- a/rafs/src/metadata/layout/mod.rs +++ b/rafs/src/metadata/layout/mod.rs @@ -318,7 +318,7 @@ mod tests { #[test] fn test_bootstrap_convert() { let mut value = 0x504030201u64; - let buf: &mut [u8] = &mut value.as_mut_slice(); + let buf = value.as_mut_slice(); let v: std::io::Result<&MockU32> = (&buf[1..5]).try_into(); assert!(v.is_err()); diff --git a/rafs/src/metadata/layout/v5.rs b/rafs/src/metadata/layout/v5.rs index e7ff0611770..d9a12f3b69e 100644 --- a/rafs/src/metadata/layout/v5.rs +++ b/rafs/src/metadata/layout/v5.rs @@ -847,13 +847,13 @@ impl RafsV5ExtBlobTable { pub fn load(&mut self, r: &mut RafsIoReader, count: usize) -> Result<()> { let mut entries = Vec::::with_capacity(count); // Safe because it is already reserved enough space - let (_, mut data, _) = unsafe { + let (_, data, _) = unsafe { entries.set_len(count); (&mut entries).align_to_mut::() }; - r.read_exact(&mut data)?; - self.entries = entries.to_vec().into_iter().map(Arc::new).collect(); + r.read_exact(data)?; + self.entries = entries.iter().cloned().map(Arc::new).collect(); Ok(()) } @@ -1387,7 +1387,7 @@ pub(crate) fn rafsv5_validate_digest( return Ok(false); } let child_digest = child.get_digest(); - let child_digest = child_digest.as_ref().as_ref(); + let child_digest = child_digest.as_ref(); hasher.digest_update(child_digest); } @@ -1579,6 +1579,7 @@ pub mod tests { pub uncompress_offset: u64, pub file_offset: u64, pub index: u32, + #[allow(unused)] pub reserved: u32, } @@ -1815,11 +1816,11 @@ pub mod tests { assert_eq!(table.size(), 0); assert_eq!(table.len(), 0); - assert_eq!(table.is_empty(), true); + assert!(table.is_empty()); table.add_entry(0x1); assert_eq!(table.size(), 8); assert_eq!(table.len(), 1); - assert_eq!(table.is_empty(), false); + assert!(!table.is_empty()); let tmp_file = TempFile::new().unwrap(); let file = OpenOptions::new() @@ -1843,7 +1844,7 @@ pub mod tests { table.load_prefetch_table_from(&mut reader, 8, 2).unwrap(); assert_eq!(table.size(), 8); assert_eq!(table.len(), 2); - assert_eq!(table.is_empty(), false); + assert!(!table.is_empty()); assert_eq!(table.inodes[0], 0x1); assert_eq!(table.inodes[1], 0x0); } @@ -1853,12 +1854,12 @@ pub mod tests { let mut inode = RafsV5Inode::new(); inode.set_name_size(3); assert_eq!(inode.size(), 136); - assert_eq!(inode.is_symlink(), false); - assert_eq!(inode.is_hardlink(), false); - assert_eq!(inode.is_dir(), false); - assert_eq!(inode.is_reg(), false); - assert_eq!(inode.has_hole(), false); - assert_eq!(inode.has_xattr(), false); + assert!(!inode.is_symlink()); + assert!(!inode.is_hardlink()); + assert!(!inode.is_dir()); + assert!(!inode.is_reg()); + assert!(!inode.has_hole()); + assert!(!inode.has_xattr()); let mut inode = RafsV5Inode::new(); inode.set_symlink_size(3); diff --git a/rafs/src/metadata/layout/v6.rs b/rafs/src/metadata/layout/v6.rs index 3099d6291cf..73cd94e6791 100644 --- a/rafs/src/metadata/layout/v6.rs +++ b/rafs/src/metadata/layout/v6.rs @@ -1198,6 +1198,7 @@ impl Default for RafsV6Blob { impl_bootstrap_converter!(RafsV6Blob); impl RafsV6Blob { + #[allow(clippy::wrong_self_convention)] fn to_blob_info(&self) -> Result { // debug_assert!(RAFS_DIGEST_LENGTH == 32); debug_assert!(size_of::() == 256); @@ -2021,7 +2022,7 @@ mod tests { let mut entry1 = RafsV6XattrEntry::new(); reader.read_exact(entry1.as_mut()).unwrap(); - assert_eq!((entry1 == target1 || entry1 == target2), true); + assert!((entry1 == target1 || entry1 == target2)); size += size_of::() + entry1.name_len() as usize @@ -2034,9 +2035,9 @@ mod tests { let mut entry2 = RafsV6XattrEntry::new(); reader.read_exact(entry2.as_mut()).unwrap(); if entry1 == target1 { - assert_eq!(entry2 == target2, true); + assert!(entry2 == target2); } else { - assert_eq!(entry2 == target1, true); + assert!(entry2 == target1); } } } diff --git a/rafs/src/metadata/md_v5.rs b/rafs/src/metadata/md_v5.rs index a3cafe0a92d..928c952a5d0 100644 --- a/rafs/src/metadata/md_v5.rs +++ b/rafs/src/metadata/md_v5.rs @@ -162,7 +162,7 @@ impl RafsSuper { pub(crate) fn amplify_io( &self, max_size: u32, - descs: &mut Vec, + descs: &mut [BlobIoVec], inode: &Arc, window_base: u64, mut window_size: u64, diff --git a/rafs/src/metadata/md_v6.rs b/rafs/src/metadata/md_v6.rs index 1783ecf79f2..54e88ac696e 100644 --- a/rafs/src/metadata/md_v6.rs +++ b/rafs/src/metadata/md_v6.rs @@ -135,7 +135,7 @@ mod tests { ..Default::default() }; - assert_eq!(rs.try_load_v6(&mut reader).unwrap(), false); + assert!(!rs.try_load_v6(&mut reader).unwrap()); } #[test] @@ -155,7 +155,7 @@ mod tests { ..Default::default() }; - assert_eq!(rs.try_load_v6(&mut reader).unwrap(), false); + assert!(!rs.try_load_v6(&mut reader).unwrap()); } #[test] diff --git a/rafs/src/metadata/mod.rs b/rafs/src/metadata/mod.rs index 1abfeee0963..5b39bf695d0 100644 --- a/rafs/src/metadata/mod.rs +++ b/rafs/src/metadata/mod.rs @@ -263,7 +263,7 @@ impl Default for RafsSuperFlags { impl Display for RafsSuperFlags { fn fmt(&self, f: &mut Formatter) -> FmtResult { - write!(f, "{}", format!("{:?}", self))?; + write!(f, "{:?}", self)?; Ok(()) } } @@ -452,7 +452,7 @@ impl RafsSuper { /// Create a new `RafsSuper` instance from a `RafsConfig` object. pub fn new(conf: &RafsConfig) -> Result { Ok(Self { - mode: RafsMode::from_str(&conf.mode.as_str())?, + mode: RafsMode::from_str(conf.mode.as_str())?, validate_digest: conf.digest_validate, ..Default::default() }) diff --git a/rafs/src/metadata/noop.rs b/rafs/src/metadata/noop.rs index 2004dc10ed6..1da05a3a7f9 100644 --- a/rafs/src/metadata/noop.rs +++ b/rafs/src/metadata/noop.rs @@ -13,14 +13,9 @@ use storage::device::BlobInfo; use crate::metadata::{Inode, RafsInode, RafsSuperBlock, RafsSuperInodes}; use crate::{RafsIoReader, RafsResult}; +#[derive(Default)] pub struct NoopSuperBlock {} -impl Default for NoopSuperBlock { - fn default() -> Self { - Self {} - } -} - impl NoopSuperBlock { pub fn new() -> Self { Self::default() diff --git a/rafs/src/mock/mock_inode.rs b/rafs/src/mock/mock_inode.rs index 7f4a16526a3..16278e9caf4 100644 --- a/rafs/src/mock/mock_inode.rs +++ b/rafs/src/mock/mock_inode.rs @@ -29,6 +29,7 @@ use crate::metadata::{ use storage::device::v5::BlobV5ChunkInfo; #[derive(Default, Clone, Debug)] +#[allow(unused)] pub struct MockInode { i_ino: Inode, i_name: OsString, diff --git a/rafs/src/mock/mock_super.rs b/rafs/src/mock/mock_super.rs index e667c01193f..87f9e227b1f 100644 --- a/rafs/src/mock/mock_super.rs +++ b/rafs/src/mock/mock_super.rs @@ -13,20 +13,13 @@ use storage::device::BlobInfo; use crate::metadata::{Inode, RafsInode, RafsSuperBlock, RafsSuperInodes}; use crate::{RafsIoReader, RafsResult}; +#[derive(Default)] pub struct MockSuperBlock { pub inodes: HashMap>, } pub const CHUNK_SIZE: u32 = 200; -impl Default for MockSuperBlock { - fn default() -> Self { - Self { - inodes: HashMap::new(), - } - } -} - impl MockSuperBlock { pub fn new() -> Self { Self { diff --git a/src/bin/nydus-image/builder/diff.rs b/src/bin/nydus-image/builder/diff.rs index e73002de09c..1dcfcb5cc4f 100644 --- a/src/bin/nydus-image/builder/diff.rs +++ b/src/bin/nydus-image/builder/diff.rs @@ -159,7 +159,7 @@ fn same_file(f1: &Node, f2: &Node) -> bool { return false; } let cap_name = OsStr::new("security.capability"); - if f1.xattrs.get(&cap_name) != f2.xattrs.get(&cap_name) { + if f1.xattrs.get(cap_name) != f2.xattrs.get(cap_name) { return false; } if !f1.is_dir() { @@ -751,7 +751,7 @@ impl DiffBuilder { } let blob_mgr = self.blob_map.to_blob_mgr(); - BuildOutput::new(&blob_mgr, &bootstrap_mgr) + BuildOutput::new(&blob_mgr, bootstrap_mgr) } fn build_with_diff( @@ -804,7 +804,7 @@ impl DiffBuilder { } let blob_mgr = self.blob_map.to_blob_mgr(); - BuildOutput::new(&blob_mgr, &bootstrap_mgr) + BuildOutput::new(&blob_mgr, bootstrap_mgr) } } diff --git a/src/bin/nydus-image/builder/directory.rs b/src/bin/nydus-image/builder/directory.rs index ef92f6a9ab6..0cc983d72aa 100644 --- a/src/bin/nydus-image/builder/directory.rs +++ b/src/bin/nydus-image/builder/directory.rs @@ -191,6 +191,6 @@ impl Builder for DirectoryBuilder { } bootstrap_mgr.add(bootstrap_ctx); - BuildOutput::new(&blob_mgr, &bootstrap_mgr) + BuildOutput::new(blob_mgr, bootstrap_mgr) } } diff --git a/src/bin/nydus-image/builder/stargz.rs b/src/bin/nydus-image/builder/stargz.rs index a51fde845e2..dec9106fc94 100644 --- a/src/bin/nydus-image/builder/stargz.rs +++ b/src/bin/nydus-image/builder/stargz.rs @@ -98,6 +98,7 @@ struct TocEntry { pub offset: u64, // the Offset of the next entry with a non-zero Offset + #[allow(unused)] #[serde(skip)] pub next_offset: u64, @@ -137,9 +138,11 @@ struct TocEntry { #[serde(default, rename = "chunkSize")] pub chunk_size: u64, + #[allow(unused)] #[serde(skip)] pub children: Vec, + #[allow(unused)] #[serde(skip)] pub inode: u64, } @@ -402,14 +405,14 @@ impl StargzIndexTreeBuilder { } } if entry.is_reg() { - last_reg_entry = Some(&entry); + last_reg_entry = Some(entry); } if entry.is_chunk() { continue; } let mut lost_dirs = Vec::new(); - self.make_lost_dirs(&entry, &mut lost_dirs)?; + self.make_lost_dirs(entry, &mut lost_dirs)?; for dir in &lost_dirs { let node = self.parse_node(dir, ctx.explicit_uidgid, ctx.fs_version, layer_idx)?; nodes.push(node); @@ -664,6 +667,6 @@ impl Builder for StargzBuilder { bootstrap.dump(ctx, &mut bootstrap_ctx, &blob_table)?; bootstrap_mgr.add(bootstrap_ctx); - BuildOutput::new(&blob_mgr, &bootstrap_mgr) + BuildOutput::new(blob_mgr, bootstrap_mgr) } } diff --git a/src/bin/nydus-image/core/blob_compact.rs b/src/bin/nydus-image/core/blob_compact.rs index f6b0cf7da8b..008918fd1d4 100644 --- a/src/bin/nydus-image/core/blob_compact.rs +++ b/src/bin/nydus-image/core/blob_compact.rs @@ -85,6 +85,7 @@ impl ChunkKey { #[derive(Clone, Debug)] struct ChunkSet { chunks: HashMap, + #[allow(unused)] version: RafsVersion, total_size: usize, } diff --git a/src/bin/nydus-image/core/bootstrap.rs b/src/bin/nydus-image/core/bootstrap.rs index eef313b14b4..af494bafd37 100644 --- a/src/bin/nydus-image/core/bootstrap.rs +++ b/src/bin/nydus-image/core/bootstrap.rs @@ -105,7 +105,7 @@ impl Bootstrap { timing_tracer!( { for node in &bootstrap_ctx.nodes { - tree.apply(&node, true, ctx.whiteout_spec) + tree.apply(node, true, ctx.whiteout_spec) .context("failed to apply tree")?; } Ok(true) @@ -285,7 +285,7 @@ impl Bootstrap { } /* XXX: `.' and `..' should be sorted globally too */ node.dirents - .sort_unstable_by(|a, b| a.1.as_os_str().cmp(&b.1.as_os_str()) as std::cmp::Ordering); + .sort_unstable_by(|a, b| a.1.as_os_str().cmp(b.1.as_os_str()) as std::cmp::Ordering); for dir in dirs { self.update_dirents(nodes, dir, tree.node.offset); @@ -364,8 +364,8 @@ impl Bootstrap { blob_table: &RafsBlobTable, ) -> Result<()> { match blob_table { - RafsBlobTable::V5(table) => self.dump_rafsv5(ctx, bootstrap_ctx, &table), - RafsBlobTable::V6(table) => self.dump_rafsv6(ctx, bootstrap_ctx, &table), + RafsBlobTable::V5(table) => self.dump_rafsv5(ctx, bootstrap_ctx, table), + RafsBlobTable::V6(table) => self.dump_rafsv6(ctx, bootstrap_ctx, table), } } @@ -484,7 +484,7 @@ impl Bootstrap { timing_tracer!( { for node in &bootstrap_ctx.nodes { - node.dump_bootstrap_v5(&ctx, bootstrap_ctx.writer.as_mut()) + node.dump_bootstrap_v5(ctx, bootstrap_ctx.writer.as_mut()) .context("failed to dump bootstrap")?; } diff --git a/src/bin/nydus-image/core/context.rs b/src/bin/nydus-image/core/context.rs index 312b9dbaec8..9e990116933 100644 --- a/src/bin/nydus-image/core/context.rs +++ b/src/bin/nydus-image/core/context.rs @@ -218,7 +218,7 @@ impl ArtifactWriter { ArtifactStorage::FileDir(ref p) => { // Better we can use open(2) O_TMPFILE, but for compatibility sake, we delay this job. // TODO: Blob dir existence? - let tmp = TempFile::new_in(&p) + let tmp = TempFile::new_in(p) .with_context(|| format!("failed to create temp file in {:?}", p))?; let tmp2 = tmp.as_file().try_clone()?; Ok(Self { @@ -569,6 +569,7 @@ impl BlobManager { self.blobs.last() } + #[allow(clippy::wrong_self_convention)] pub fn from_blob_table(&mut self, blob_table: Vec>) { self.blobs = blob_table .iter() diff --git a/src/bin/nydus-image/core/node.rs b/src/bin/nydus-image/core/node.rs index 14345d9a4f9..b5c74cdf5f4 100644 --- a/src/bin/nydus-image/core/node.rs +++ b/src/bin/nydus-image/core/node.rs @@ -355,8 +355,8 @@ impl Node { chunk_size }; - let mut chunk_data = &mut blob_ctx.chunk_data_buf[0..chunk_size as usize]; - file.read_exact(&mut chunk_data) + let chunk_data = &mut blob_ctx.chunk_data_buf[0..chunk_size as usize]; + file.read_exact(chunk_data) .with_context(|| format!("failed to read node file {:?}", self.path))?; // TODO: check for hole chunks. One possible way is to always save @@ -411,7 +411,7 @@ impl Node { } // Compress chunk data - let (compressed, is_compressed) = compress::compress(&chunk_data, ctx.compressor) + let (compressed, is_compressed) = compress::compress(chunk_data, ctx.compressor) .with_context(|| format!("failed to compress node file {:?}", self.path))?; let compressed_size = compressed.len(); @@ -637,7 +637,7 @@ impl Node { 0, RafsV6Dirent::file_type(*file_type), ); - dirents.push((entry, &name)); + dirents.push((entry, name)); nameoff += size_of::() as u64; used += len as u64; @@ -1869,7 +1869,7 @@ mod tests { node.set_v6_offset(&mut bootstrap_ctx); assert_eq!(node.offset, 0); assert_eq!(node.v6_datalayout, EROFS_INODE_CHUNK_BASED); - assert_eq!(node.v6_compact_inode, true); + assert!(node.v6_compact_inode); assert_eq!(bootstrap_ctx.offset, 32); // symlink and dir are handled in the same way. @@ -1980,7 +1980,7 @@ mod tests { ) .unwrap(); - assert_eq!(reg_node.v6_compact_inode, true); + assert!(reg_node.v6_compact_inode); let pyc_node = Node::new( RafsVersion::V6, @@ -1993,7 +1993,7 @@ mod tests { ) .unwrap(); - assert_eq!(pyc_node.v6_compact_inode, false); + assert!(!pyc_node.v6_compact_inode); std::fs::remove_file(&pa_pyc).unwrap(); } diff --git a/src/bin/nydus-image/core/tree.rs b/src/bin/nydus-image/core/tree.rs index 7382c23a1a3..82da6f83515 100644 --- a/src/bin/nydus-image/core/tree.rs +++ b/src/bin/nydus-image/core/tree.rs @@ -48,10 +48,10 @@ impl Tree { /// Load a `Tree` from a bootstrap file, and optionally caches chunk information. pub fn from_bootstrap(rs: &RafsSuper, chunk_dict: &mut T) -> Result { - let tree_builder = MetadataTreeBuilder::new(&rs); + let tree_builder = MetadataTreeBuilder::new(rs); let root_inode = rs.get_inode(RAFS_ROOT_INODE, true)?; let root_node = - MetadataTreeBuilder::parse_node(&rs, root_inode.as_ref(), PathBuf::from("/"))?; + MetadataTreeBuilder::parse_node(rs, root_inode.as_ref(), PathBuf::from("/"))?; let mut tree = Tree::new(root_node); tree.children = timing_tracer!( @@ -277,7 +277,7 @@ impl<'a> MetadataTreeBuilder<'a> { let child = inode.get_child_by_index(idx)?; let child_ino = child.ino(); let child_path = parent_path.join(child.name()); - let child = Self::parse_node(&self.rs, child.as_ref(), child_path)?; + let child = Self::parse_node(self.rs, child.as_ref(), child_path)?; if child.is_reg() { for chunk in &child.chunks { @@ -323,7 +323,7 @@ impl<'a> MetadataTreeBuilder<'a> { for name in inode.get_xattrs()? { let name = bytes_to_os_str(&name); let value = inode.get_xattr(name)?; - xattrs.add(name.to_os_string(), value.unwrap_or_else(Vec::new)); + xattrs.add(name.to_os_string(), value.unwrap_or_default()); } // Nodes loaded from bootstrap will only be used as `Overlay::Lower`, so make `dev` invalid diff --git a/src/bin/nydus-image/inspect.rs b/src/bin/nydus-image/inspect.rs index 109926724c0..a205780a5ae 100644 --- a/src/bin/nydus-image/inspect.rs +++ b/src/bin/nydus-image/inspect.rs @@ -729,7 +729,7 @@ pub(crate) enum ExecuteError { IllegalCommand, ArgumentParse, Exit, - ExecuteError(anyhow::Error), + ExecError(anyhow::Error), } pub(crate) struct Executor {} @@ -740,7 +740,7 @@ impl Executor { input: String, ) -> std::result::Result, ExecuteError> { let mut raw = input - .strip_suffix("\n") + .strip_suffix('\n') .unwrap_or(&input) .split_ascii_whitespace(); let cmd = match raw.next() { @@ -789,7 +789,7 @@ impl Executor { }; } } - .map_err(ExecuteError::ExecuteError)?; + .map_err(ExecuteError::ExecError)?; Ok(output) } @@ -826,7 +826,7 @@ impl Prompt { Err(ExecuteError::Exit) => break, Err(ExecuteError::IllegalCommand) => continue, Err(ExecuteError::HelpCommand) => continue, - Err(ExecuteError::ExecuteError(e)) => { + Err(ExecuteError::ExecError(e)) => { println!("Failed in executing command, {:?}", e); continue; } diff --git a/src/bin/nydus-image/main.rs b/src/bin/nydus-image/main.rs index ca66ad393d2..0b2083678c1 100644 --- a/src/bin/nydus-image/main.rs +++ b/src/bin/nydus-image/main.rs @@ -571,19 +571,19 @@ struct Command {} impl Command { fn create(matches: &clap::ArgMatches, build_info: &BuildTimeInfo) -> Result<()> { - let blob_id = Self::get_blob_id(&matches)?; - let chunk_size = Self::get_chunk_size(&matches)?; - let blob_offset = Self::get_blob_offset(&matches)?; - let parent_bootstrap = Self::get_parent_bootstrap(&matches)?; + let blob_id = Self::get_blob_id(matches)?; + let chunk_size = Self::get_chunk_size(matches)?; + let blob_offset = Self::get_blob_offset(matches)?; + let parent_bootstrap = Self::get_parent_bootstrap(matches)?; let source_path = PathBuf::from(matches.value_of("SOURCE").unwrap()); let extra_paths: Vec = matches .values_of("SOURCE") .map(|paths| paths.map(PathBuf::from).skip(1).collect()) .unwrap(); let source_type: SourceType = matches.value_of("source-type").unwrap().parse()?; - let blob_stor = Self::get_blob_storage(&matches, source_type)?; + let blob_stor = Self::get_blob_storage(matches, source_type)?; let repeatable = matches.is_present("repeatable"); - let version = Self::get_fs_version(&matches)?; + let version = Self::get_fs_version(matches)?; let aligned_chunk = if version.is_v6() { info!("v6 enforces to use \"aligned-chunk\"."); true @@ -654,12 +654,12 @@ impl Command { Self::ensure_directory(&bootstrap_dir)?; ArtifactStorage::FileDir(PathBuf::from(bootstrap_dir)) } else { - let bootstrap_path = Self::get_bootstrap(&matches)?; + let bootstrap_path = Self::get_bootstrap(matches)?; ArtifactStorage::SingleFile(PathBuf::from(bootstrap_path)) }; BootstrapManager::new(Some(storage), parent_bootstrap) } else { - let bootstrap_path = Self::get_bootstrap(&matches)?; + let bootstrap_path = Self::get_bootstrap(matches)?; BootstrapManager::new( Some(ArtifactStorage::SingleFile(PathBuf::from(bootstrap_path))), parent_bootstrap, @@ -694,11 +694,11 @@ impl Command { if let Some(bootstrap_path) = bootstrap_mgr.get_bootstrap_path(&build_output.last_bootstrap_name) { - Self::validate_image(&matches, &bootstrap_path)?; + Self::validate_image(matches, &bootstrap_path)?; info!("build successfully: {:?}", build_output,); } - OutputSerializer::dump(matches, build_output, &build_info)?; + OutputSerializer::dump(matches, build_output, build_info)?; Ok(()) } @@ -708,7 +708,7 @@ impl Command { .values_of("SOURCE") .map(|paths| paths.map(PathBuf::from).collect()) .unwrap(); - let target_bootstrap_path = Self::get_bootstrap(&matches)?; + let target_bootstrap_path = Self::get_bootstrap(matches)?; let chunk_dict_path = if let Some(arg) = matches.value_of("chunk-dict") { Some(parse_chunk_dict_arg(arg)?) } else { @@ -752,7 +752,7 @@ impl Command { if let Some(build_output) = BlobCompactor::do_compact(bootstrap_path, dst_bootstrap, chunk_dict, backend, &config)? { - OutputSerializer::dump(matches, build_output, &build_info)?; + OutputSerializer::dump(matches, build_output, build_info)?; } Ok(()) } @@ -766,7 +766,7 @@ impl Command { .with_context(|| format!("failed to check bootstrap {:?}", bootstrap_path))?; info!("bootstrap is valid, blobs: {:?}", blob_ids); - OutputSerializer::dump_with_check(matches, &build_info, blob_ids)?; + OutputSerializer::dump_with_check(matches, build_info, blob_ids)?; Ok(()) } @@ -931,7 +931,7 @@ impl Command { #[allow(dead_code)] fn validate_image(matches: &clap::ArgMatches, bootstrap_path: &Path) -> Result<()> { if !matches.is_present("disable-check") { - let mut validator = Validator::new(&bootstrap_path)?; + let mut validator = Validator::new(bootstrap_path)?; timing_tracer!( { validator diff --git a/src/bin/nydus-image/merge.rs b/src/bin/nydus-image/merge.rs index 9a522d22890..e2ac82916f2 100644 --- a/src/bin/nydus-image/merge.rs +++ b/src/bin/nydus-image/merge.rs @@ -75,7 +75,7 @@ impl Merger { // Get the blobs come from chunk dict bootstrap. let mut chunk_dict_blobs = HashSet::new(); if let Some(chunk_dict_path) = &chunk_dict { - let rs = RafsSuper::load_from_metadata(&chunk_dict_path, RafsMode::Direct, true) + let rs = RafsSuper::load_from_metadata(chunk_dict_path, RafsMode::Direct, true) .context(format!("load chunk dict bootstrap {:?}", chunk_dict_path))?; for blob in rs.superblock.get_blob_infos() { chunk_dict_blobs.insert(blob.blob_id().to_string()); @@ -83,7 +83,7 @@ impl Merger { } for (layer_idx, bootstrap_path) in sources.iter().enumerate() { - let rs = RafsSuper::load_from_metadata(&bootstrap_path, RafsMode::Direct, true) + let rs = RafsSuper::load_from_metadata(bootstrap_path, RafsMode::Direct, true) .context(format!("load bootstrap {:?}", bootstrap_path))?; let current_flags = Flags::from_meta(&rs.meta); @@ -172,7 +172,7 @@ impl Merger { let storage = ArtifactStorage::SingleFile(target.clone()); let mut bootstrap_ctx = BootstrapContext::new(Some(storage), false, false)?; bootstrap.build(ctx, &mut bootstrap_ctx, &mut tree)?; - let blob_table = blob_mgr.to_blob_table(&ctx)?; + let blob_table = blob_mgr.to_blob_table(ctx)?; bootstrap .dump(ctx, &mut bootstrap_ctx, &blob_table) .context(format!("dump bootstrap to {:?}", target))?; diff --git a/src/bin/nydus-image/trace.rs b/src/bin/nydus-image/trace.rs index 6818e1dfb14..dde82b0dce2 100644 --- a/src/bin/nydus-image/trace.rs +++ b/src/bin/nydus-image/trace.rs @@ -297,13 +297,7 @@ pub mod tests { t3.join().unwrap(); let map = root_tracer!().dump_summary_map().unwrap(); - assert_eq!( - map["registered_events"]["event_1"].as_u64(), - serde::export::Some(600) - ); - assert_eq!( - map["registered_events"]["event_2"].as_u64(), - serde::export::Some(900) - ); + assert_eq!(map["registered_events"]["event_1"].as_u64(), Some(600)); + assert_eq!(map["registered_events"]["event_2"].as_u64(), Some(900)); } } diff --git a/src/bin/nydusctl/commands.rs b/src/bin/nydusctl/commands.rs index 171ddeb0319..f97c2097e3f 100644 --- a/src/bin/nydusctl/commands.rs +++ b/src/bin/nydusctl/commands.rs @@ -59,7 +59,7 @@ impl CommandBlobcache { let m = metrics.as_object().unwrap(); if raw { - println!("{}", metrics.to_string()); + println!("{}", metrics); } else { print!( r#" @@ -191,7 +191,7 @@ Block Sizes/millis: } if raw { - println!("{}", metrics.to_string()); + println!("{}", metrics); } else { let sizes = vec!["<1K", "1K~", "4K~", "16K~", "64K~", "128K~", "512K~", "1M~"]; let m = metrics.as_object().unwrap(); @@ -264,7 +264,7 @@ impl CommandFsStats { let m = metrics.as_object().unwrap(); let fop_counter = m["fop_hits"].as_array().unwrap(); if raw { - println!("{}", metrics.to_string()); + println!("{}", metrics); } else { print!( r#" @@ -326,7 +326,7 @@ impl CommandDaemon { let backend_list = i["backend_collection"].as_object().unwrap(); if raw { - println!("{}", info.to_string()); + println!("{}", info); } else { let version_info = &i["version"]; print!( @@ -408,7 +408,7 @@ impl CommandUmount { let mountpoint = &p["mountpoint"]; client - .delete("mount", None, Some(vec![("mountpoint", &mountpoint)])) + .delete("mount", None, Some(vec![("mountpoint", mountpoint)])) .await } } diff --git a/src/bin/nydusd/fusedev.rs b/src/bin/nydusd/fusedev.rs index 084222fd8e7..f913241b20d 100644 --- a/src/bin/nydusd/fusedev.rs +++ b/src/bin/nydusd/fusedev.rs @@ -399,7 +399,7 @@ fn is_mounted(mp: impl AsRef) -> Result { let match_mp = mpb.iter().find(|mp_stat| unsafe { let mp_name = CStr::from_ptr(&mp_stat.f_mntonname as *const i8); let mp = CStr::from_ptr(mp.as_ptr()); - mp.eq(&mp_name) + mp.eq(mp_name) }); Ok(match_mp.is_some()) diff --git a/src/bin/nydusd/main.rs b/src/bin/nydusd/main.rs index 9fefaa3697a..f9042584881 100644 --- a/src/bin/nydusd/main.rs +++ b/src/bin/nydusd/main.rs @@ -29,7 +29,7 @@ use clap::{App, Arg, ArgMatches, SubCommand, Values}; use fuse_backend_rs::api::{Vfs, VfsOptions}; use mio::{Events, Poll, Token, Waker}; use nix::sys::signal; -use rlimit::{rlim, Resource}; +use rlimit::Resource; use nydus::FsBackendType; use nydus_app::{dump_program_info, setup_logging, BuildTimeInfo}; @@ -55,9 +55,9 @@ mod service_controller; mod upgrade; /// Minimal number of file descriptors reserved for system. -const RLIMIT_NOFILE_RESERVED: rlim = 16384; +const RLIMIT_NOFILE_RESERVED: u64 = 16384; /// Default number of file descriptors. -const RLIMIT_NOFILE_MAX: rlim = 1_000_000; +const RLIMIT_NOFILE_MAX: u64 = 1_000_000; lazy_static! { static ref DAEMON_CONTROLLER: DaemonController = DaemonController::new(); @@ -440,10 +440,10 @@ fn prepare_commandline_options() -> App<'static, 'static> { } #[cfg(target_os = "macos")] -fn get_max_rlimit_nofile() -> Result { +fn get_max_rlimit_nofile() -> Result { let mut mib = [nix::libc::CTL_KERN, nix::libc::KERN_MAXFILES]; - let mut file_max: rlim = 0; - let mut size = std::mem::size_of::(); + let mut file_max: u64 = 0; + let mut size = std::mem::size_of::(); // Safe because the arguments are valid and we have checked the result. let res = unsafe { nix::libc::sysctl( @@ -460,18 +460,18 @@ fn get_max_rlimit_nofile() -> Result { } #[cfg(target_os = "linux")] -fn get_max_rlimit_nofile() -> Result { +fn get_max_rlimit_nofile() -> Result { let file_max = std::fs::read_to_string("/proc/sys/fs/file-max")?; file_max .trim() - .parse::() + .parse::() .map_err(|_| eother!("invalid content from fs.file-max")) } /// Handle command line option to tune rlimit for maximum file descriptor number. fn handle_rlimit_nofile_option(args: &ArgMatches, option_name: &str) -> Result<()> { // `rlimit-nofile` has a default value, so safe to unwrap(). - let rlimit_nofile: rlim = args.value_of(option_name).unwrap().parse().map_err(|_e| { + let rlimit_nofile: u64 = args.value_of(option_name).unwrap().parse().map_err(|_e| { Error::new( ErrorKind::InvalidInput, "invalid value for option `rlimit-nofile`", diff --git a/storage/Cargo.toml b/storage/Cargo.toml index cdb698f860d..854fb6c9be1 100644 --- a/storage/Cargo.toml +++ b/storage/Cargo.toml @@ -15,6 +15,7 @@ arc-swap = "=0.4" base64 = { version = "0.13.0", optional = true } bitflags = "1.2.1" futures = "0.3" +# pin governor to avoid multi versions of hashbrown governor = "=0.4.1" hmac = { version = "0.12.1", optional = true } httpdate = { version = "1.0", optional = true } diff --git a/storage/src/backend/connection.rs b/storage/src/backend/connection.rs index 1efd71406c2..53e2c09bb84 100644 --- a/storage/src/backend/connection.rs +++ b/storage/src/backend/connection.rs @@ -382,9 +382,9 @@ mod tests { #[test] fn test_is_success_status() { - assert_eq!(is_success_status(StatusCode::CONTINUE), false); - assert_eq!(is_success_status(StatusCode::OK), true); - assert_eq!(is_success_status(StatusCode::PERMANENT_REDIRECT), true); - assert_eq!(is_success_status(StatusCode::BAD_REQUEST), false); + assert!(!is_success_status(StatusCode::CONTINUE)); + assert!(is_success_status(StatusCode::OK)); + assert!(is_success_status(StatusCode::PERMANENT_REDIRECT)); + assert!(!is_success_status(StatusCode::BAD_REQUEST)); } } diff --git a/storage/src/backend/localfs.rs b/storage/src/backend/localfs.rs index 72ba9133956..1bb49ba7c2e 100644 --- a/storage/src/backend/localfs.rs +++ b/storage/src/backend/localfs.rs @@ -408,12 +408,14 @@ impl LocalFsTracer { /// Struct to prefetch blob data according to access trace. #[derive(Debug)] struct Prefetcher { - blob_file: File, // blob file for readahead - blob_size: u64, // blob file size - log_path: String, // log file path - log_file: File, // file for access logging + blob_file: File, // blob file for readahead + blob_size: u64, // blob file size + #[allow(unused)] + log_path: String, // log file path + #[allow(unused)] + log_file: File, // file for access logging log_base: *const u8, // mmapped access log base - log_size: u64, // size of mmapped area + log_size: u64, // size of mmapped area records: ManuallyDrop>, } @@ -734,8 +736,8 @@ mod tests { let mut trace: Vec = vec![Default::default(); 4]; let log_path = path.to_str().unwrap().to_owned() + BLOB_ACCESSED_SUFFIX; let mut log_file = File::open(&log_path).unwrap(); - let mut buf = unsafe { std::slice::from_raw_parts_mut(trace.as_mut_ptr() as *mut u8, 64) }; - assert_eq!(log_file.read(&mut buf).unwrap(), 32); + let buf = unsafe { std::slice::from_raw_parts_mut(trace.as_mut_ptr() as *mut u8, 64) }; + assert_eq!(log_file.read(buf).unwrap(), 32); assert_eq!(trace[0].0, 0x0); assert_eq!(trace[0].1, 0x1000); diff --git a/storage/src/backend/mod.rs b/storage/src/backend/mod.rs index 47886afc3a1..3df4cd6b438 100644 --- a/storage/src/backend/mod.rs +++ b/storage/src/backend/mod.rs @@ -18,7 +18,7 @@ use std::sync::Arc; use fuse_backend_rs::transport::FileVolatileSlice; use nydus_utils::metrics::{BackendMetrics, ERROR_HOLDER}; -use crate::utils::copyv; +use crate::utils::{alloc_buf, copyv}; use crate::StorageError; #[cfg(any(feature = "backend-oss", feature = "backend-registry"))] @@ -188,8 +188,7 @@ pub trait BlobReader: Send + Sync { // Use std::alloc to avoid zeroing the allocated buffer. let size = bufs.iter().fold(0usize, move |size, s| size + s.len()); let size = std::cmp::min(size, max_size); - let mut data = Vec::with_capacity(size); - unsafe { data.set_len(size) }; + let mut data = alloc_buf(size); let result = self.read(&mut data, offset)?; copyv(&[&data], bufs, 0, result, 0, 0) @@ -253,7 +252,7 @@ mod tests { assert_eq!(config.connect_timeout, 5); assert_eq!(config.retry_limit, 0); assert_eq!(config.proxy.check_interval, 5); - assert_eq!(config.proxy.fallback, true); + assert!(config.proxy.fallback); assert_eq!(config.proxy.ping_url, ""); assert_eq!(config.proxy.url, ""); } diff --git a/storage/src/backend/oss.rs b/storage/src/backend/oss.rs index e1a0c627611..9df29e06d17 100644 --- a/storage/src/backend/oss.rs +++ b/storage/src/backend/oss.rs @@ -233,6 +233,7 @@ pub struct Oss { connection: Arc, state: Arc, metrics: Option>, + #[allow(unused)] id: Option, } @@ -336,7 +337,7 @@ mod tests { #[test] fn test_oss_new() { let json_str = "{\"access_key_id\":\"key\",\"access_key_secret\":\"secret\",\"bucket_name\":\"images\",\"endpoint\":\"/oss\",\"object_prefix\":\"nydus\",\"scheme\":\"\",\"proxy\":{\"url\":\"\",\"ping_url\":\"\",\"fallback\":true,\"check_interval\":5},\"timeout\":5,\"connect_timeout\":5,\"retry_limit\":5}"; - let json: Value = serde_json::from_str(&json_str).unwrap(); + let json: Value = serde_json::from_str(json_str).unwrap(); let oss = Oss::new(json, Some("test-image")).unwrap(); oss.metrics(); diff --git a/storage/src/backend/registry.rs b/storage/src/backend/registry.rs index 942065a6c59..c4163bc6b0f 100644 --- a/storage/src/backend/registry.rs +++ b/storage/src/backend/registry.rs @@ -125,6 +125,7 @@ struct TokenResponse { #[derive(Debug)] struct BasicAuth { + #[allow(unused)] realm: String, } diff --git a/storage/src/cache/cachedfile.rs b/storage/src/cache/cachedfile.rs index 681cca1f0ef..c3931e29e16 100644 --- a/storage/src/cache/cachedfile.rs +++ b/storage/src/cache/cachedfile.rs @@ -336,7 +336,7 @@ impl BlobObject for FileCacheEntry { } } - self.do_fetch_chunks(&chunks) + self.do_fetch_chunks(chunks) } } diff --git a/storage/src/cache/filecache/mod.rs b/storage/src/cache/filecache/mod.rs index 7e429569c42..37d1aeecd34 100644 --- a/storage/src/cache/filecache/mod.rs +++ b/storage/src/cache/filecache/mod.rs @@ -122,7 +122,7 @@ impl FileCacheMgr { } let entry = FileCacheEntry::new_file_cache( - &self, + self, blob.clone(), self.prefetch_config.clone(), self.runtime.clone(), @@ -339,7 +339,7 @@ pub mod blob_cache_tests { ); let mut blob_config: FileCacheConfig = serde_json::from_str(&s).unwrap(); - assert_eq!(blob_config.disable_indexed_map, false); + assert!(!blob_config.disable_indexed_map); assert_eq!(blob_config.work_dir, dir.to_str().unwrap()); /* assert_eq!(blob_config.get_work_dir().unwrap(), dir.to_str().unwrap()); diff --git a/storage/src/cache/state/blob_state_map.rs b/storage/src/cache/state/blob_state_map.rs index 1153ea0e2a0..7117ca3d065 100644 --- a/storage/src/cache/state/blob_state_map.rs +++ b/storage/src/cache/state/blob_state_map.rs @@ -530,12 +530,9 @@ pub(crate) mod tests { .unwrap(); } for idx in 0..chunk_count { - assert_eq!( - chunk_map - .check_ready_and_mark_pending(chunks[idx as usize].as_ref()) - .unwrap(), - true - ); + assert!(chunk_map + .check_ready_and_mark_pending(chunks[idx as usize].as_ref()) + .unwrap(),); } } @@ -606,34 +603,25 @@ pub(crate) mod tests { index_map .set_ready_and_clear_pending(chunk_1.as_ref()) .unwrap(); - assert_eq!( - index_map - .check_ready_and_mark_pending(chunk_1.as_ref()) - .unwrap(), - true - ); + assert!(index_map + .check_ready_and_mark_pending(chunk_1.as_ref()) + .unwrap(),); assert_eq!(index_map.inflight_tracer.lock().unwrap().len(), 1); index_map.clear_pending(chunk_2.as_ref()); assert_eq!(index_map.inflight_tracer.lock().unwrap().len(), 0); - assert_eq!( - index_map - .check_ready_and_mark_pending(chunk_2.as_ref()) - .unwrap(), - false - ); + assert!(!index_map + .check_ready_and_mark_pending(chunk_2.as_ref()) + .unwrap(),); assert_eq!(index_map.inflight_tracer.lock().unwrap().len(), 1); index_map.clear_pending(chunk_2.as_ref()); assert_eq!(index_map.inflight_tracer.lock().unwrap().len(), 0); index_map .set_ready_and_clear_pending(chunk_2.as_ref()) .unwrap(); - assert_eq!( - index_map - .check_ready_and_mark_pending(chunk_2.as_ref()) - .unwrap(), - true - ); + assert!(index_map + .check_ready_and_mark_pending(chunk_2.as_ref()) + .unwrap(),); assert_eq!(index_map.inflight_tracer.lock().unwrap().len(), 0); // digested ChunkMap @@ -655,19 +643,13 @@ pub(crate) mod tests { digest_map .set_ready_and_clear_pending(chunk_1.as_ref()) .unwrap(); - assert_eq!( - digest_map - .check_ready_and_mark_pending(chunk_1.as_ref()) - .unwrap(), - true - ); + assert!(digest_map + .check_ready_and_mark_pending(chunk_1.as_ref()) + .unwrap(),); digest_map.clear_pending(chunk_2.as_ref()); - assert_eq!( - digest_map - .check_ready_and_mark_pending(chunk_2.as_ref()) - .unwrap(), - false - ); + assert!(!digest_map + .check_ready_and_mark_pending(chunk_2.as_ref()) + .unwrap(),); digest_map.clear_pending(chunk_2.as_ref()); assert_eq!(digest_map.inflight_tracer.lock().unwrap().len(), 0); } @@ -685,12 +667,10 @@ pub(crate) mod tests { c }); - assert_eq!( - map.as_ref() - .check_ready_and_mark_pending(chunk_4.as_ref()) - .unwrap(), - false - ); + assert!(!map + .as_ref() + .check_ready_and_mark_pending(chunk_4.as_ref()) + .unwrap(),); let map_cloned = map.clone(); assert_eq!(map.inflight_tracer.lock().unwrap().len(), 1); @@ -701,7 +681,7 @@ pub(crate) mod tests { let ready = map_cloned .check_ready_and_mark_pending(chunk_4_cloned.as_ref()) .unwrap(); - assert_eq!(ready, true); + assert!(ready); } }) .unwrap(); @@ -714,7 +694,7 @@ pub(crate) mod tests { let ready = map_cloned_2 .check_ready_and_mark_pending(chunk_4_cloned_2.as_ref()) .unwrap(); - assert_eq!(ready, true); + assert!(ready); } }) .unwrap(); @@ -791,9 +771,9 @@ pub(crate) mod tests { IndexedChunkMap::new(tmp_file.as_path().to_str().unwrap(), 10, true).unwrap(), )); - assert_eq!(map.is_range_all_ready(), false); - assert_eq!(map.is_range_ready(0, 1).unwrap(), false); - assert_eq!(map.is_range_ready(9, 1).unwrap(), false); + assert!(!map.is_range_all_ready()); + assert!(!map.is_range_ready(0, 1).unwrap()); + assert!(!map.is_range_ready(9, 1).unwrap()); assert!(map.is_range_ready(10, 1).is_err()); assert_eq!( map.check_range_ready_and_mark_pending(0, 2).unwrap(), @@ -808,8 +788,8 @@ pub(crate) mod tests { ); map.set_range_ready_and_clear_pending(2, 1).unwrap(); map.set_range_ready_and_clear_pending(3, 7).unwrap(); - assert_eq!(map.is_range_ready(0, 1).unwrap(), true); - assert_eq!(map.is_range_ready(9, 1).unwrap(), true); - assert_eq!(map.is_range_all_ready(), true); + assert!(map.is_range_ready(0, 1).unwrap()); + assert!(map.is_range_ready(9, 1).unwrap()); + assert!(map.is_range_all_ready()); } } diff --git a/storage/src/cache/state/indexed_chunk_map.rs b/storage/src/cache/state/indexed_chunk_map.rs index c168d8f6035..379c9ceca86 100644 --- a/storage/src/cache/state/indexed_chunk_map.rs +++ b/storage/src/cache/state/indexed_chunk_map.rs @@ -211,10 +211,10 @@ mod tests { assert_eq!(map.map.not_ready_count.load(Ordering::Acquire), 1); assert_eq!(map.map.count, 1); assert_eq!(map.map.size, 0x1001); - assert_eq!(map.is_range_all_ready(), false); - assert_eq!(map.is_ready(chunk.as_base()).unwrap(), false); + assert!(!map.is_range_all_ready()); + assert!(!map.is_ready(chunk.as_base()).unwrap()); map.set_ready_and_clear_pending(chunk.as_base()).unwrap(); - assert_eq!(map.is_ready(chunk.as_base()).unwrap(), true); + assert!(map.is_ready(chunk.as_base()).unwrap()); } #[test] @@ -247,10 +247,10 @@ mod tests { assert_eq!(map.map.not_ready_count.load(Ordering::Acquire), 1); assert_eq!(map.map.count, 1); assert_eq!(map.map.size, 0x1001); - assert_eq!(map.is_range_all_ready(), false); - assert_eq!(map.is_ready(chunk.as_base()).unwrap(), false); + assert!(!map.is_range_all_ready()); + assert!(!map.is_ready(chunk.as_base()).unwrap()); map.set_ready_and_clear_pending(chunk.as_base()).unwrap(); - assert_eq!(map.is_ready(chunk.as_base()).unwrap(), true); + assert!(map.is_ready(chunk.as_base()).unwrap()); } #[test] @@ -290,12 +290,12 @@ mod tests { assert_eq!(chunk.id(), 0); let map = IndexedChunkMap::new(&blob_path, 1, true).unwrap(); - assert_eq!(map.is_range_all_ready(), true); + assert!(map.is_range_all_ready()); assert_eq!(map.map.count, 1); assert_eq!(map.map.size, 0x1001); - assert_eq!(map.is_ready(chunk.as_base()).unwrap(), true); + assert!(map.is_ready(chunk.as_base()).unwrap()); map.set_ready_and_clear_pending(chunk.as_base()).unwrap(); - assert_eq!(map.is_ready(chunk.as_base()).unwrap(), true); + assert!(map.is_ready(chunk.as_base()).unwrap()); } #[test] @@ -338,9 +338,9 @@ mod tests { assert_eq!(map.map.not_ready_count.load(Ordering::Acquire), 1); assert_eq!(map.map.count, 1); assert_eq!(map.map.size, 0x1001); - assert_eq!(map.is_range_all_ready(), false); - assert_eq!(map.is_ready(chunk.as_base()).unwrap(), false); + assert!(!map.is_range_all_ready()); + assert!(!map.is_ready(chunk.as_base()).unwrap()); map.set_ready_and_clear_pending(chunk.as_base()).unwrap(); - assert_eq!(map.is_ready(chunk.as_base()).unwrap(), true); + assert!(map.is_ready(chunk.as_base()).unwrap()); } } diff --git a/storage/src/cache/worker.rs b/storage/src/cache/worker.rs index 25931db3490..fc464aac1b2 100644 --- a/storage/src/cache/worker.rs +++ b/storage/src/cache/worker.rs @@ -24,6 +24,7 @@ use fuse_backend_rs::transport::FileVolatileSlice; /// Configuration information for asynchronous workers. pub(crate) struct AsyncPrefetchConfig { /// Whether or not to eneable prefetch. + #[allow(unused)] pub enable: bool, /// Number of working threads. pub threads_count: usize, diff --git a/storage/src/device.rs b/storage/src/device.rs index 575321ad138..71b9fb55004 100644 --- a/storage/src/device.rs +++ b/storage/src/device.rs @@ -1079,7 +1079,7 @@ impl FileReadWriteVolatile for BlobDeviceIoVec<'_> { if let Some(index) = self.iovec.get_target_blob_index() { let blobs = &self.dev.blobs.load(); if (index as usize) < blobs.len() { - return blobs[index as usize].read(&mut self.iovec, buffers); + return blobs[index as usize].read(self.iovec, buffers); } } @@ -1153,8 +1153,8 @@ mod tests { assert_eq!(iochunk.compress_size(), 0x100); assert_eq!(iochunk.uncompress_offset(), 0x2000); assert_eq!(iochunk.uncompress_size(), 0x200); - assert_eq!(iochunk.is_compressed(), false); - assert_eq!(iochunk.is_hole(), false); + assert!(!iochunk.is_compressed()); + assert!(!iochunk.is_hole()); } #[test] diff --git a/storage/src/meta/mod.rs b/storage/src/meta/mod.rs index f619f705e6b..c8cef54e111 100644 --- a/storage/src/meta/mod.rs +++ b/storage/src/meta/mod.rs @@ -14,6 +14,7 @@ //! `blobid.blob.meata`. Together with the chunk map file `blobid.chunkmap`, they may be used to //! optimize the communication between blob manager and blob manager clients such as virtiofsd. +use std::any::Any; use std::fs::OpenOptions; use std::io::Result; use std::mem::{size_of, ManuallyDrop}; @@ -26,7 +27,7 @@ use nydus_utils::digest::RafsDigest; use crate::backend::BlobReader; use crate::device::{BlobChunkInfo, BlobInfo, BlobIoChunk}; -use std::any::Any; +use crate::utils::alloc_buf; const BLOB_METADATA_MAX_CHUNKS: u32 = 0xf_ffff; const BLOB_METADATA_MAX_SIZE: u64 = 0x100_0000u64; @@ -586,9 +587,7 @@ impl BlobMetaInfo { } } else { let compressed_size = blob_info.meta_ci_compressed_size(); - let mut buf = Vec::with_capacity(compressed_size as usize); - unsafe { buf.set_len(compressed_size as usize) }; - + let mut buf = alloc_buf(compressed_size as usize); let size = reader .read(&mut buf, blob_info.meta_ci_offset()) .map_err(|e| eio!(format!("failed to read metadata from backend, {:?}", e)))?; @@ -820,11 +819,11 @@ mod tests { assert_eq!(chunk.uncompressed_size(), 0x100); assert_eq!(chunk.uncompressed_end(), 0x2100); assert_eq!(chunk.aligned_uncompressed_end(), 0x3000); - assert_eq!(chunk.is_compressed(), false); + assert!(!chunk.is_compressed()); chunk.set_uncompressed_size(0x200); assert_eq!(chunk.uncompressed_size(), 0x200); - assert_eq!(chunk.is_compressed(), true); + assert!(chunk.is_compressed()); } #[test] @@ -871,8 +870,8 @@ mod tests { assert_eq!(vec[0].compress_size(), 0x1000); assert_eq!(vec[0].uncompress_offset(), 0); assert_eq!(vec[0].uncompress_size(), 0x1001); - assert_eq!(vec[0].is_compressed(), true); - assert_eq!(vec[0].is_hole(), false); + assert!(vec[0].is_compressed()); + assert!(!vec[0].is_hole()); let vec = info.get_chunks_uncompressed(0x0, 0x4000, 0).unwrap(); assert_eq!(vec.len(), 2); @@ -882,8 +881,8 @@ mod tests { assert_eq!(vec[1].compress_size(), 0x2000); assert_eq!(vec[1].uncompress_offset(), 0x2000); assert_eq!(vec[1].uncompress_size(), 0x2000); - assert_eq!(vec[1].is_compressed(), false); - assert_eq!(vec[1].is_hole(), false); + assert!(!vec[1].is_compressed()); + assert!(!vec[1].is_hole()); let vec = info.get_chunks_uncompressed(0x0, 0x4001, 0).unwrap(); assert_eq!(vec.len(), 3); @@ -980,7 +979,7 @@ mod tests { }; let pos = 0; - w.write_all(&data).unwrap(); + w.write_all(data).unwrap(); let mut blob_info = BlobInfo::new( 0, @@ -999,8 +998,7 @@ mod tests { compress::Algorithm::None as u32, ); - let mut buffer = Vec::with_capacity(data.len()); - unsafe { buffer.set_len(data.len()) }; + let mut buffer = alloc_buf(data.len()); let reader: Arc = Arc::new(DummyBlobReader { metrics: BackendMetrics::new("dummy", "localfs"), file: r, @@ -1043,7 +1041,7 @@ mod tests { }; let (buf, compressed) = compress::compress(data, compress::Algorithm::Lz4Block).unwrap(); - assert_eq!(compressed, true); + assert!(compressed); let pos = 0; w.write_all(&buf).unwrap(); @@ -1067,8 +1065,7 @@ mod tests { compress::Algorithm::Lz4Block as u32, ); - let mut buffer = Vec::with_capacity(uncompressed_size); - unsafe { buffer.set_len(uncompressed_size) }; + let mut buffer = alloc_buf(uncompressed_size); let reader: Arc = Arc::new(DummyBlobReader { metrics: BackendMetrics::new("dummy", "localfs"), file: r, diff --git a/storage/src/remote/connection.rs b/storage/src/remote/connection.rs index 60215c83d11..65d0d008bb0 100644 --- a/storage/src/remote/connection.rs +++ b/storage/src/remote/connection.rs @@ -501,7 +501,7 @@ impl Endpoint { .take(n) .map(|fd| { // Safe because we have the ownership of `fd`. - unsafe { File::from_raw_fd(*fd) } + File::from_raw_fd(*fd) }) .collect(); Some(files) diff --git a/storage/src/remote/message.rs b/storage/src/remote/message.rs index b1d304de26f..9a47a42f120 100644 --- a/storage/src/remote/message.rs +++ b/storage/src/remote/message.rs @@ -378,22 +378,22 @@ mod tests { assert_eq!(hdr.get_version(), 0x1); - assert_eq!(hdr.is_reply(), false); + assert!(!hdr.is_reply()); hdr.set_reply(true); - assert_eq!(hdr.is_reply(), true); + assert!(hdr.is_reply()); hdr.set_reply(false); - assert_eq!(hdr.is_need_reply(), false); + assert!(!hdr.is_need_reply()); hdr.set_need_reply(true); - assert_eq!(hdr.is_need_reply(), true); + assert!(hdr.is_need_reply()); hdr.set_need_reply(false); assert_eq!(hdr.get_size(), 0x100); hdr.set_size(0x200); assert_eq!(hdr.get_size(), 0x200); - assert_eq!(hdr.is_need_reply(), false); - assert_eq!(hdr.is_reply(), false); + assert!(!hdr.is_need_reply()); + assert!(!hdr.is_reply()); assert_eq!(hdr.get_version(), 0x1); // Check message length diff --git a/storage/src/remote/server.rs b/storage/src/remote/server.rs index 395fd7d18dd..8d1447f6376 100644 --- a/storage/src/remote/server.rs +++ b/storage/src/remote/server.rs @@ -96,7 +96,7 @@ impl ClientConnection { } hdr.set_reply(true); - guard.send_header(&hdr, None).map_err(|_e| eio!()) + guard.send_header(hdr, None).map_err(|_e| eio!()) } fn handle_get_blob(&self, hdr: &mut MsgHeader, mut guard: MutexGuard) -> Result<()> { @@ -121,7 +121,7 @@ impl ClientConnection { let mut guard = self.lock_conn(); hdr.set_reply(true); - guard.send_message(&hdr, &reply, None).map_err(|_e| eio!()) + guard.send_message(hdr, &reply, None).map_err(|_e| eio!()) } fn handle_fetch_range( @@ -148,7 +148,7 @@ impl ClientConnection { let mut guard = self.lock_conn(); hdr.set_reply(true); - guard.send_message(&hdr, &reply, None).map_err(|_e| eio!()) + guard.send_message(hdr, &reply, None).map_err(|_e| eio!()) } fn lock_conn(&self) -> MutexGuard { diff --git a/storage/src/test.rs b/storage/src/test.rs index ed9bd49b951..58a4089cb70 100644 --- a/storage/src/test.rs +++ b/storage/src/test.rs @@ -78,6 +78,7 @@ pub(crate) struct MockChunkInfo { pub uncompress_offset: u64, pub file_offset: u64, pub index: u32, + #[allow(unused)] pub reserved: u32, } diff --git a/storage/src/utils.rs b/storage/src/utils.rs index f2fc9308c5b..4b42b66465e 100644 --- a/storage/src/utils.rs +++ b/storage/src/utils.rs @@ -3,7 +3,6 @@ // SPDX-License-Identifier: Apache-2.0 //! Utility helpers to supprt the storage subsystem. -use std::alloc::{alloc, Layout}; use std::cmp::{self, min}; use std::io::{ErrorKind, Result}; use std::os::unix::io::RawFd; @@ -223,12 +222,13 @@ pub fn readahead(fd: libc::c_int, mut offset: u64, end: u64) { /// A customized buf allocator that avoids zeroing pub fn alloc_buf(size: usize) -> Vec { - debug_assert!(size < isize::MAX as usize); - let layout = Layout::from_size_align(size, 0x1000) - .unwrap() - .pad_to_align(); - let ptr = unsafe { alloc(layout) }; - unsafe { Vec::from_raw_parts(ptr, size, layout.size()) } + let mut buf = Vec::with_capacity(size); + // It's ok to provide uninitialized data buffer, the caller should take care of it. + #[allow(clippy::uninit_vec)] + unsafe { + buf.set_len(size) + }; + buf } /// Check hash of data matches provided one diff --git a/tests/builder.rs b/tests/builder.rs index 8b1b55ed3b2..efd58b1b4fc 100644 --- a/tests/builder.rs +++ b/tests/builder.rs @@ -143,7 +143,7 @@ impl<'a> Builder<'a> { &dir.join("sub/sub-root-large-copy-hardlink-1"), ); self.create_symlink( - &Path::new("../root-large").to_path_buf(), + Path::new("../root-large"), &dir.join("sub/sub-root-large-symlink"), ); diff --git a/tests/diff.rs b/tests/diff.rs index d9338ca05f2..f743f80b199 100644 --- a/tests/diff.rs +++ b/tests/diff.rs @@ -2,7 +2,6 @@ // // SPDX-License-Identifier: Apache-2.0 -use std::array::IntoIter; use std::collections::HashMap; use std::fs::{self, File, OpenOptions}; use std::io::prelude::*; @@ -76,7 +75,7 @@ fn create_dir(path: &Path) -> PathBuf { fn create_file(path: &Path, chunks: &[Vec]) { let mut file = File::create(path).unwrap(); for chunk in chunks { - file.write_all(&chunk).unwrap(); + file.write_all(chunk).unwrap(); } } @@ -227,7 +226,7 @@ fn integration_test_diff_build_with_chunk_dict() { vec![&layer_dir_1, &layer_dir_2, &layer_dir_3, &layer_dir_4], &snapshot_dir_4, )); - let expected_chunk_dict_bootstrap = IntoIter::new([ + let expected_chunk_dict_bootstrap = [ (PathBuf::from("/"), vec![]), ( PathBuf::from("/file-1"), @@ -292,7 +291,9 @@ fn integration_test_diff_build_with_chunk_dict() { )], ), (PathBuf::from("/file-7"), vec![]), - ]) + ] + .iter() + .cloned() .collect(); // Diff build to a chunk-dict bootstrap @@ -388,7 +389,7 @@ fn integration_test_diff_build_with_chunk_dict() { vec![&layer_dir_5, &layer_dir_6], &snapshot_dir_6, )); - let expected_bootstrap = IntoIter::new([ + let expected_bootstrap = [ (PathBuf::from("/"), vec![]), ( PathBuf::from("/file-8"), @@ -435,7 +436,9 @@ fn integration_test_diff_build_with_chunk_dict() { ), ], ), - ]) + ] + .iter() + .cloned() .collect(); // Diff build based on a chunk dict bootstrap @@ -544,7 +547,7 @@ fn integration_test_diff_build_with_chunk_dict() { &snapshot_dir_8, )); - let expected_bootstrap = IntoIter::new([ + let expected_bootstrap = [ (PathBuf::from("/"), vec![]), ( PathBuf::from("/file-1"), @@ -639,7 +642,9 @@ fn integration_test_diff_build_with_chunk_dict() { ), ], ), - ]) + ] + .iter() + .cloned() .collect(); // Diff build based on a build-cache + chunk-dict bootstrap