diff --git a/Cargo.lock b/Cargo.lock index e189651c9cde8be491e476fcf9a4bd7c38b61aac..222262c26fe05d6dced16c608ea5694dfffe62ae 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,21 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "addr2line" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + [[package]] name = "aho-corasick" version = "0.7.20" @@ -23,6 +38,21 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "backtrace" +version = "0.3.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + [[package]] name = "basic" version = "0.2.5" @@ -30,16 +60,13 @@ dependencies = [ "bitflags", "caps", "constants", - "lazy_static", "libc", - "libtests", "log", - "nix", + "nix 0.24.3", "pathdiff", "pkg-config", "procfs", "rand", - "serde", "snafu", "tempfile", "time", @@ -145,8 +172,7 @@ dependencies = [ "basic", "bitflags", "log", - "nix", - "regex", + "nix 0.24.3", "snafu", "walkdir", ] @@ -198,13 +224,22 @@ dependencies = [ "os_str_bytes", ] +[[package]] +name = "cluFlock" +version = "1.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5c0fabbd86438044c17b633a514a4e5512f356ee114d7378665d24212462f88" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "cmdproto" version = "0.2.0" dependencies = [ "http", - "libtests", - "nix", + "nix 0.24.3", "prost", "prost-build", "snafu", @@ -233,10 +268,39 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "const_format" +version = "0.2.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c990efc7a285731f9a4378d81aff2f0e85a2c8781a05ef0f8baa8dac54d0ff48" +dependencies = [ + "const_format_proc_macros", +] + +[[package]] +name = "const_format_proc_macros" +version = "0.2.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e026b6ce194a874cb9cf32cd5772d1ef9767cc8fcb5765948d74f37a9d8b2bf6" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] + [[package]] name = "constants" version = "0.2.5" +[[package]] +name = "convert_case" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" +dependencies = [ + "unicode-segmentation", +] + [[package]] name = "core" version = "0.2.5" @@ -249,8 +313,7 @@ dependencies = [ "heed", "libc", "log", - "nix", - "regex", + "nix 0.24.3", "serde", "snafu", ] @@ -295,9 +358,43 @@ dependencies = [ "libc", "log", "loopdev", - "nix", + "nix 0.24.3", + "regex", + "snafu", +] + +[[package]] +name = "devmaster" +version = "0.2.5" +dependencies = [ + "basic", + "bitflags", + "blkid_rs", + "clap", + "cluFlock", + "confique", + "device", + "event", + "fnmatch-regex", + "futures", + "input-event-codes", + "input_event_codes_rs", + "ioctl-sys", + "ioctls", + "kmod_rs", + "lazy_static", + "libc", + "log", + "nix 0.24.3", "regex", + "rtnetlink", + "serde", + "shell-words", "snafu", + "sscanf", + "tokio", + "toml", + "wait-timeout", ] [[package]] @@ -372,7 +469,7 @@ dependencies = [ "constants", "libc", "libtests", - "nix", + "nix 0.24.3", "snafu", ] @@ -444,7 +541,96 @@ version = "0.2.5" dependencies = [ "inotify", "log", - "nix", + "nix 0.24.3", +] + +[[package]] +name = "futures" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" + +[[package]] +name = "futures-executor" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" + +[[package]] +name = "futures-macro" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.28", +] + +[[package]] +name = "futures-sink" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" + +[[package]] +name = "futures-task" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" + +[[package]] +name = "futures-util" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", ] [[package]] @@ -458,6 +644,12 @@ dependencies = [ "wasi 0.11.0+wasi-snapshot-preview1", ] +[[package]] +name = "gimli" +version = "0.27.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" + [[package]] name = "glob" version = "0.3.1" @@ -539,10 +731,8 @@ name = "hostname_setup" version = "0.2.5" dependencies = [ "basic", - "constants", - "libc", "log", - "nix", + "nix 0.24.3", ] [[package]] @@ -596,6 +786,19 @@ dependencies = [ "libc", ] +[[package]] +name = "input-event-codes" +version = "5.16.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b6b0f8557f596a2db592f172015c40d0c149e16a956c7848e733d663f2c6636" + +[[package]] +name = "input_event_codes_rs" +version = "0.2.5" +dependencies = [ + "bindgen", +] + [[package]] name = "instant" version = "0.1.12" @@ -616,6 +819,22 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "ioctl-sys" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f9d0b6b23885487578d10590edc36fd95426257c7017973b20633e34df23b08" + +[[package]] +name = "ioctls" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5780ca662f733ea1b940647b657d5324abc55a7d8d9b0628e8af8fe96ab3ed2" +dependencies = [ + "ioctl-sys", + "libc", +] + [[package]] name = "itertools" version = "0.10.5" @@ -657,7 +876,7 @@ dependencies = [ "basic", "kmod-sys", "log", - "nix", + "nix 0.24.3", ] [[package]] @@ -754,10 +973,7 @@ version = "0.2.5" dependencies = [ "proc-macro2", "quote", - "serde", - "strum", "syn 1.0.109", - "toml", ] [[package]] @@ -781,6 +997,15 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" +[[package]] +name = "miniz_oxide" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +dependencies = [ + "adler", +] + [[package]] name = "mio" version = "0.8.8" @@ -804,7 +1029,7 @@ dependencies = [ "libc", "log", "macros", - "nix", + "nix 0.24.3", "once_cell", "serde", ] @@ -815,6 +1040,84 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" +[[package]] +name = "netlink-packet-core" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac48279d5062bdf175bdbcb6b58ff1d6b0ecd54b951f7a0ff4bc0550fe903ccb" +dependencies = [ + "anyhow", + "byteorder", + "libc", + "netlink-packet-utils", +] + +[[package]] +name = "netlink-packet-route" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76aed5d3b6e3929713bf1e1334a11fd65180b6d9f5d7c8572664c48b122604f8" +dependencies = [ + "anyhow", + "bitflags", + "byteorder", + "libc", + "netlink-packet-core", + "netlink-packet-utils", +] + +[[package]] +name = "netlink-packet-utils" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fcfb6f758b66e964b2339596d94078218d96aad5b32003e8e2a1d23c27a6784" +dependencies = [ + "anyhow", + "byteorder", + "paste", + "thiserror", +] + +[[package]] +name = "netlink-proto" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddd06e90449ae973fe3888c1ff85949604ef5189b4ac9a2ae39518da1e00762d" +dependencies = [ + "bytes", + "futures", + "log", + "netlink-packet-core", + "netlink-sys", + "tokio", + "tokio-util", +] + +[[package]] +name = "netlink-sys" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f48ea34ea0678719815c3753155067212f853ad2d8ef4a49167bae7f7c254188" +dependencies = [ + "futures", + "libc", + "log", + "tokio", +] + +[[package]] +name = "nix" +version = "0.22.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4916f159ed8e5de0082076562152a76b7a1f64a01fd9d1e0fea002c37624faf" +dependencies = [ + "bitflags", + "cc", + "cfg-if", + "libc", + "memoffset", +] + [[package]] name = "nix" version = "0.24.3" @@ -865,6 +1168,25 @@ dependencies = [ "notify", ] +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "object" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.7.2" @@ -887,6 +1209,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "paste" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" + [[package]] name = "pathdiff" version = "0.2.1" @@ -915,6 +1243,18 @@ dependencies = [ "indexmap", ] +[[package]] +name = "pin-project-lite" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c516611246607d0c04186886dbb3a754368ef82c79e9827a802c6d836dd111c" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + [[package]] name = "pkg-config" version = "0.3.27" @@ -1078,7 +1418,7 @@ dependencies = [ "basic", "libc", "log", - "nix", + "nix 0.24.3", "xattr", ] @@ -1125,6 +1465,27 @@ version = "0.6.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" +[[package]] +name = "rtnetlink" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c9a6200d18ec1acfc218ce71363dcc9b6075f399220f903fdfeacd476a876ef" +dependencies = [ + "futures", + "log", + "netlink-packet-route", + "netlink-proto", + "nix 0.22.3", + "thiserror", + "tokio", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + [[package]] name = "rustc-hash" version = "1.1.0" @@ -1145,12 +1506,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "rustversion" -version = "1.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" - [[package]] name = "ryu" version = "1.0.15" @@ -1170,11 +1525,10 @@ dependencies = [ name = "sctl" version = "0.1.0" dependencies = [ - "basic", "clap", "cmdproto", "constants", - "nix", + "nix 0.24.3", ] [[package]] @@ -1222,12 +1576,17 @@ dependencies = [ "libtests", "log", "macros", - "nix", + "nix 0.24.3", "once_cell", "serde", - "watchdog", ] +[[package]] +name = "shell-words" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde" + [[package]] name = "shlex" version = "1.1.0" @@ -1240,6 +1599,15 @@ version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" +[[package]] +name = "slab" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" +dependencies = [ + "autocfg", +] + [[package]] name = "snafu" version = "0.7.5" @@ -1274,42 +1642,61 @@ dependencies = [ "libtests", "log", "macros", - "nix", + "nix 0.24.3", "once_cell", "serde", ] [[package]] -name = "strum" -version = "0.23.0" +name = "socket2" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cae14b91c7d11c9a851d3fbc80a963198998c2a64eec840477fa92d8ce9b70bb" +checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" dependencies = [ - "strum_macros", + "libc", + "winapi", ] [[package]] -name = "strum_macros" -version = "0.23.1" +name = "sscanf" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bb0dc7ee9c15cea6199cde9a127fa16a4c5819af85395457ad72d68edc85a38" +checksum = "c713ebd15ce561dd4a13ed62bc2a0368e16806fc30dcaf66ecf1256b2a3fdde6" dependencies = [ - "heck 0.3.3", + "const_format", + "lazy_static", + "regex", + "sscanf_macro", +] + +[[package]] +name = "sscanf_macro" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84955aa74a157e5834d58a07be11af7f0ab923f0194a0bb2ea6b3db8b5d1611d" +dependencies = [ + "convert_case", "proc-macro2", "quote", - "rustversion", - "syn 1.0.109", + "regex-syntax", + "strsim", + "syn 2.0.28", + "unicode-width", ] +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + [[package]] name = "switch_root" version = "0.2.5" dependencies = [ "basic", - "constants", - "libc", "log", - "nix", + "nix 0.24.3", ] [[package]] @@ -1362,8 +1749,7 @@ dependencies = [ "kernlog", "log", "mio", - "nix", - "tempfile", + "nix 0.24.3", ] [[package]] @@ -1386,13 +1772,12 @@ dependencies = [ "libtests", "log", "mount", - "nix", + "nix 0.24.3", "once_cell", "regex", "serde", "service", "siphasher", - "snafu", "socket", "target", "walkdir", @@ -1403,7 +1788,7 @@ name = "sysmonitor" version = "0.2.5" dependencies = [ "basic", - "nix", + "nix 0.24.3", "procfs", "serde", "serde_derive", @@ -1418,7 +1803,7 @@ dependencies = [ "core", "log", "macros", - "nix", + "nix 0.24.3", "once_cell", "serde", ] @@ -1489,6 +1874,37 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" +[[package]] +name = "tokio" +version = "1.29.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "532826ff75199d5833b9d2c5fe410f29235e25704ee5f0ef599fb51c21f4a4da" +dependencies = [ + "autocfg", + "backtrace", + "bytes", + "libc", + "mio", + "num_cpus", + "pin-project-lite", + "socket2", + "windows-sys 0.48.0", +] + +[[package]] +name = "tokio-util" +version = "0.6.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36943ee01a6d67977dd3f84a5a1d2efeb4ada3a1ae771cadfaa535d9d9fc6507" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "log", + "pin-project-lite", + "tokio", +] + [[package]] name = "toml" version = "0.5.11" @@ -1525,6 +1941,12 @@ version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" +[[package]] +name = "unicode-width" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" + [[package]] name = "unicode-xid" version = "0.2.4" @@ -1548,6 +1970,15 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "wait-timeout" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6" +dependencies = [ + "libc", +] + [[package]] name = "walkdir" version = "2.3.3" @@ -1574,7 +2005,7 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" name = "watchdog" version = "0.2.5" dependencies = [ - "nix", + "nix 0.24.3", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index e250169f6364fce1f4f5a70c094ca1eec536fc5e..4b97426633b5ecc14874b11e7440ed2b2f5a0408 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,7 +27,7 @@ nix = { version = "0.24", default-features = false, features = [ "user", ] } kernlog = "0.3.1" -tempfile = "=3.6.0" +# tempfile = "=3.6.0" # 此为开发配置文件, 给 `cargo build` 所使用. [profile.dev] diff --git a/ci/00-pre.sh b/ci/00-pre.sh index ec389fe90fa0135fc4b2f10c0f9f87334d96e028..29e29a682555502021e2ef1c22459907b8e0ba00 100755 --- a/ci/00-pre.sh +++ b/ci/00-pre.sh @@ -40,16 +40,11 @@ fi source "$HOME/.cargo/env" rustup default 1.57 -arch=`uname -m` -# install musl-build -rustup target add $arch-unknown-linux-musl - # Define the crate names to test crate_names=("https://github.com/rust-lang/crates.io-index" \ "https://mirrors.ustc.edu.cn/crates.io-index" \ "https://rsproxy.cn/crates.io-index" \ "https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git" \ - "https://code.aliyun.com/rustcc/crates.io-index.git" \ "https://mirrors.sjtug.sjtu.edu.cn/git/crates.io-index") # Initialize minimum latency to a large value diff --git a/ci/02-musl-build.sh b/ci/02-musl-build.sh index ca554d39ee30e6585ae70675aca6cadc9618188a..185fd333bc27ae6a94f215a38c8efcd1597ed6d5 100755 --- a/ci/02-musl-build.sh +++ b/ci/02-musl-build.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash #RUST_BACKTRACE=1 cargo run --release -p sysmaster --example signals - +echo "(Optional) Build sysMaster with musl." arch=`uname -m` # install musl-build rustup target add $arch-unknown-linux-musl diff --git a/core/coms/mount/src/manager.rs b/core/coms/mount/src/manager.rs index d3657fe73c3dfca44511236d4f9a164a8a371ee8..a08ac3d8a12b9778718991ab9930613c3e0d7b6e 100755 --- a/core/coms/mount/src/manager.rs +++ b/core/coms/mount/src/manager.rs @@ -307,7 +307,7 @@ impl MountMonitorData { }; let me_fd = me_file.as_raw_fd(); - let me_epfd = epoll::create(false).unwrap(); + let me_epfd = epoll::create(true).unwrap(); let event = epoll::Events::EPOLLET | epoll::Events::EPOLLIN; let me_epevent = epoll::Event::new(event, me_fd as u64); let op = epoll::ControlOptions::EPOLL_CTL_ADD; diff --git a/core/coms/service/Cargo.toml b/core/coms/service/Cargo.toml index bd958c561bae65671939e9224b79dfb72be0ee09..bc6f26b6275111c39736598534a55113a489fd4a 100755 --- a/core/coms/service/Cargo.toml +++ b/core/coms/service/Cargo.toml @@ -16,7 +16,7 @@ constants = { path = "../../../libs/constants" } core = { path = "../../libcore", default-features = false } event = { path = "../../../libs/event" } macros = { path = "../../../libs/macros" } -watchdog = { path = "../../../libs/watchdog" } +# watchdog = { path = "../../../libs/watchdog" } confique = { version = "0.1.3", default-features = false } libc = { version = "0.2.*", default-features = false } diff --git a/core/coms/socket/src/mng.rs b/core/coms/socket/src/mng.rs index 50440d91a3fb1e0bf9f927f4cf59f788e60c8408..f52b5e69bef69e7a73906c4857b4e48e957e59fa 100755 --- a/core/coms/socket/src/mng.rs +++ b/core/coms/socket/src/mng.rs @@ -485,7 +485,7 @@ impl SocketMng { Ok(pid) => self.pid.set_control(pid), Err(e) => { #[allow(clippy::unit_arg)] - self.comm.owner().map_or( + let _ = self.comm.owner().map_or( log::error!("Failed to run stop post cmd and service unit id is None"), |u| { log::error!( diff --git a/core/libcore/Cargo.toml b/core/libcore/Cargo.toml index 3c31814f17d81ae3ed77950c41715807c1e18d0c..20f1a3d7df3ee5b3245776ef45868c75f6e9d10c 100755 --- a/core/libcore/Cargo.toml +++ b/core/libcore/Cargo.toml @@ -18,7 +18,7 @@ heed = { version = "0.10.6", features = ["lmdb"], default-features = false } libc = { version = "0.2.*", default-features = false } log = { version = "=0.4.14", default_features = false } nix = { version = "0.24", default-features = false } -regex = { version = "1.6.0", default-features = false } +# regex = { version = "1.6.0", default-features = false } serde = { version = "1.0.130", default-features = false } snafu = { version = "0.7", default-features = false } diff --git a/core/sctl/Cargo.toml b/core/sctl/Cargo.toml index d84825ce87035130caa16ac890298a95839cb36f..011d228f7b34d8f67205b2d74c597169a2292eeb 100755 --- a/core/sctl/Cargo.toml +++ b/core/sctl/Cargo.toml @@ -6,11 +6,12 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -basic = { path = "../../libs/basic" } +# basic = { path = "../../libs/basic" } +cmdproto = { path = "../../libs/cmdproto" } +constants = { path = "../../libs/constants" } + clap = { version = "3.1.8", features = [ "derive", "std", ], default-features = false } -cmdproto = { path = "../../libs/cmdproto" } -constants = { path = "../../libs/constants" } nix = { version = "0.24", default-features = false } diff --git a/core/sysmaster/Cargo.toml b/core/sysmaster/Cargo.toml index 21a64ac64a66a8f18248ab397aa87b8a7772735b..1cc52c24664a27f92a60c2b3402cb234ae19bfb0 100755 --- a/core/sysmaster/Cargo.toml +++ b/core/sysmaster/Cargo.toml @@ -37,12 +37,16 @@ fnmatch-regex = "0.2.0" lazy_static = "1.4.0" libc = { version = "0.2.*", default-features = false } log = { version = "=0.4.14", default_features = false } -nix = { version = "0.24", default-features = false, features = ["reboot"] } +nix = { version = "0.24", default-features = false, features = [ + "reboot", + "mount", + "socket", +] } once_cell = { version = "=1.7.2", default-features = false } regex = { version = "1.6.0", default-features = false } serde = { version = "1.0.130", default-features = false } siphasher = { version = "0.3", default-features = false } -snafu = { version = "0.7", default-features = false } +# snafu = { version = "0.7", default-features = false } walkdir = "2" [features] diff --git a/exts/devmaster/Cargo.toml b/exts/devmaster/Cargo.toml index 1a5f659d3dba5b747d2f0a0b4d96a7f21c119d59..9e0688be3539059e5c9020267e26d5b40ca0f433 100644 --- a/exts/devmaster/Cargo.toml +++ b/exts/devmaster/Cargo.toml @@ -20,39 +20,44 @@ path = "src/lib/lib.rs" [dependencies] # internal libraries -device = { path = "../../libs/device" } -event = { path = "../../libs/event" } basic = { path = "../../libs/basic" } blkid_rs = { path = "../../libs/blkid_rs" } -kmod_rs = { path = "../../libs/kmod_rs" } +device = { path = "../../libs/device" } +event = { path = "../../libs/event" } input_event_codes_rs = { path = "../../libs/input_event_codes_rs" } +kmod_rs = { path = "../../libs/kmod_rs" } # third libraries -libc = "0.2.*" bitflags = "1.3.2" -thiserror = "1.0" -netlink-sys = "0.8.0" -nix = "0.24" -log = { version = "=0.4.14", default_features = false, features = ["std"] } -snafu = "0.7" -clap = { version = "3.1.8", features = ["derive"] } -lazy_static = "1.4.0" -regex = "1.7.0" -fnmatch-regex = "0.2.0" -wait-timeout = "0.2.0" -shell-words = "1.1.0" -sscanf = "0.4.0" -serde = "1.0.130" +clap = { version = "3.1.8", default_features = false, features = [ + "derive", + "std", +] } +cluFlock = { version = "1.2.7", default-features = false } confique = { version = "0.1.3", default-features = false, features = ['toml'] } -loopdev = "0.4.0" -cluFlock = "1.2.7" +fnmatch-regex = "0.2.0" +futures = { version = "0.3.13", default-features = false } input-event-codes = "5.16.8" -ioctls = "0.6.1" ioctl-sys = "0.7.1" +ioctls = "0.6.1" +lazy_static = "1.4.0" +libc = { version = "0.2.*", default-features = false } +log = { version = "=0.4.14", default_features = false } +# loopdev = "0.4.0" +# netlink-sys = "0.8.0" +nix = { version = "0.24", default-features = false, features = ["uio"] } +regex = { version = "1.7.0", default_features = false } rtnetlink = "0.8.1" -futures = "0.3.13" -tokio = { version = "1.29.1", features = ["full"] } -toml = "0.5.2" +serde = { version = "1.0.130", default-features = false } +shell-words = "1.1.0" +snafu = { version = "0.7", default-features = false } +sscanf = "0.4.0" +# thiserror = "1.0" +tokio = { version = "1.29.1", default_features = false, features = [ + "rt-multi-thread", +] } +toml = "0.5.8" +wait-timeout = "0.2.0" [build-dependencies] basic = { path = "../../libs/basic" } diff --git a/exts/hostname_setup/Cargo.toml b/exts/hostname_setup/Cargo.toml index fb509272b0a6dd1363ddca8472563e81c72f773d..ce26654a70a95542d82199bce664eaaff7a521f5 100644 --- a/exts/hostname_setup/Cargo.toml +++ b/exts/hostname_setup/Cargo.toml @@ -7,9 +7,9 @@ edition = "2021" [dependencies] basic = { path = "../../libs/basic" } -constants = { path = "../../libs/constants" } +# constants = { path = "../../libs/constants" } -libc = { version = "0.2.*", default-features = false } +# libc = { version = "0.2.*", default-features = false } log = { version = "=0.4.14", default_features = false } nix = { version = "0.24", default-features = false, features = [ "mount", diff --git a/exts/switch_root/Cargo.toml b/exts/switch_root/Cargo.toml index 153303563541b96134100728f9beaee3874fccbf..b0ba4deffd8ce2e3eab20b9821c24727b3d9c9a7 100644 --- a/exts/switch_root/Cargo.toml +++ b/exts/switch_root/Cargo.toml @@ -7,8 +7,8 @@ edition = "2021" [dependencies] basic = { path = "../../libs/basic" } -constants = { path = "../../libs/constants" } +# constants = { path = "../../libs/constants" } -libc = { version = "0.2.*", default-features = false } +# libc = { version = "0.2.*", default-features = false } log = { version = "=0.4.14", default_features = false } nix = { version = "0.24", default-features = false, features = ["mount"] } diff --git a/libs/basic/Cargo.toml b/libs/basic/Cargo.toml index 87243c7024c16dde73d66239710eee141221cb6b..f57c5ead247fc4d94fd22b395b5454551687eda2 100644 --- a/libs/basic/Cargo.toml +++ b/libs/basic/Cargo.toml @@ -10,7 +10,7 @@ constants = { path = "../constants" } bitflags = "1.3.2" caps = "0.5.5" -lazy_static = "1.4.0" +# lazy_static = "1.4.0" libc = { version = "0.2.140", default-features = false } log = { version = "=0.4.14", default_features = false, features = ["std"] } nix = { version = "0.24", features = [ @@ -26,12 +26,12 @@ pathdiff = "0.2.1" pkg-config = "0.3" procfs = { version = "0.12.0", default-features = false } rand = "0.8.5" -serde = { version = "1.0.130", default-features = false } +# serde = { version = "1.0.130", default-features = false } snafu = { version = "0.7", features = ["std"], default-features = false } time = "=0.1.45" [dev-dependencies] -libtests = { path = "../libtests" } +# libtests = { path = "../libtests" } tempfile = "3.6.0" [features] diff --git a/libs/cgroup/Cargo.toml b/libs/cgroup/Cargo.toml index bc9d386ab4876a037340b3b38766c576f8c482fb..8cf6624b32e5ad51c1274bc54bbeea355113dff5 100644 --- a/libs/cgroup/Cargo.toml +++ b/libs/cgroup/Cargo.toml @@ -10,7 +10,7 @@ basic = { path = "../basic" } bitflags = "1.3.2" log = { version = "=0.4.14", default_features = false } nix = { version = "0.24", default-features = false } -regex = { version = "1.6.0", default-features = false, features = ["std"] } +# regex = { version = "1.6.0", default-features = false, features = ["std"] } snafu = { version = "0.7", default-features = false } walkdir = "2" diff --git a/libs/cmdproto/Cargo.toml b/libs/cmdproto/Cargo.toml index 0aae8441efbac8ad34b057dd7c9bd6e0492097a5..0c3d4de6d2cf79759a9c54b474d691454b968533 100644 --- a/libs/cmdproto/Cargo.toml +++ b/libs/cmdproto/Cargo.toml @@ -16,7 +16,7 @@ snafu = { features = ["std"], default-features = false, version = "0.7" } prost-build = "0.9" # 编译 protobuf [dev-dependencies] -libtests = { path = "../../libs/libtests" } +# libtests = { path = "../../libs/libtests" } [[example]] name = "signals" diff --git a/libs/event/src/timer.rs b/libs/event/src/timer.rs index 6169186f7c54a0f87d3ec78e53777160186918e5..53d42e9747d4ee1518c085cc47882b6df27b4236 100644 --- a/libs/event/src/timer.rs +++ b/libs/event/src/timer.rs @@ -14,7 +14,6 @@ use std::{ cmp::Ordering, collections::{BinaryHeap, HashMap}, mem, - ops::Deref, rc::Rc, }; @@ -214,7 +213,7 @@ impl TimerInner { let mut tmp = BinaryHeap::::new(); for clock_data in self.data.iter() { if clock_data.source().cmp(&source) != Ordering::Equal { - tmp.push(clock_data.deref().clone()); + tmp.push(clock_data.clone()); } } self.data.clear(); diff --git a/libs/input_event_codes_rs/Cargo.toml b/libs/input_event_codes_rs/Cargo.toml index 0f34dc98a3f9e581ba8701cae74ffa3421935b10..26b368c30c29c79aa49b2908033a96663d16f4fb 100644 --- a/libs/input_event_codes_rs/Cargo.toml +++ b/libs/input_event_codes_rs/Cargo.toml @@ -11,7 +11,7 @@ features = ["runtime"] version = "0.63.0" [build-dependencies] -basic = { path = "../basic" } +# basic = { path = "../basic" } [dependencies] -libc = "0.2.*" +# libc = "0.2.*" diff --git a/libs/macros/Cargo.toml b/libs/macros/Cargo.toml index de0d89985b25d2eb2755ac1995a80313f8dbd100..c3bf77d4ac26b0ac44f0fc1c10677fc5d73dbdd4 100644 --- a/libs/macros/Cargo.toml +++ b/libs/macros/Cargo.toml @@ -11,7 +11,7 @@ proc-macro = true [dependencies] proc-macro2 = { version = "1.0" } quote = { version = "1.0" } -serde = "1.0.130" -strum = { version = "0.23", features = ["derive"] } +# serde = "1.0.130" +# strum = { version = "0.23", features = ["derive"] } syn = { version = "1.0", features = ["extra-traits"] } -toml = "0.5.8" +# toml = "0.5.8" diff --git a/patch/README.md b/patch/README.md new file mode 100644 index 0000000000000000000000000000000000000000..815fcf61bc22636d26c8e818c50b576016467204 --- /dev/null +++ b/patch/README.md @@ -0,0 +1,14 @@ +# 此目录为补丁目录,主要应用于对依赖的修改 + +## 1. 制作补丁 +- 推荐`git checkout -b new_patches`创建新分支来单 +- 再执行`./vendor.sh`来创建vendor目录和依赖的软件源码 +- 在**vendor**下对应的源码目录中提交修改 +- 使用`git format-patch -n` 来创建补丁 +- 将patch提交开发分支的**patch**目录中, 建议做好序号和命名管理, 必须以patch结尾, 如`0001-fix bug in clap 2.0.patch` + +## 2. 发布源码包 + +- 获取对应版本源码(包含**patch**目录) +- (可选)对相应代码做裁剪定制 +- 执行`./vendor.sh`制作对应的**tar.gz**源码发布包 diff --git a/vendor.sh b/vendor.sh index 923296eb43b4f1f8793df424cdea373be9a971da..3c25aaca580e1725cefcc6e0b8c199ca4e96118c 100755 --- a/vendor.sh +++ b/vendor.sh @@ -1,9 +1,12 @@ #!/usr/bin/env bash +echo "cargo vendor ..." rustup override set stable rm -rf vendor cargo vendor rustup override unset + +echo "set vendor replace crates.io ..." grep -i "vendored-sources" .cargo/config if [ $? -ne 0 ]; then cat << EOF >> .cargo/config @@ -17,4 +20,19 @@ directory = "vendor" EOF fi -for i in `ls ci/*.sh | sort -u -d | grep -v "00-pre.sh" `; do date; sh -x -e $i; done +echo "Applying patches in patch directory ..." +for i in `ls patch/*.patch | sort -u -d` +do + git am $i +done + +echo "Cargo build ..." +for i in `ls ci/*.sh | sort -u -d | grep -v "00-pre.sh" ` +do + date; sh -x -e $i; +done + +echo "Create a compressed archive of tar.gz ..." +version_line=$(grep -Eo 'version = "[0-9]+\.[0-9]+\.[0-9]+"' ./Cargo.toml) +version=$(echo "$version_line" | awk -F'"' '{print $2}') +echo "You can create sysmaster-$version.tar.gz by using the tar -zcvf command."