lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 3 Aug 2022 12:23:37 +0300
From:   Konstantin Shelekhin <k.shelekhin@...ro.com>
To:     <wei.liu@...nel.org>
CC:     <linux-kernel@...r.kernel.org>, <ojeda@...nel.org>,
        <rust-for-linux@...r.kernel.org>
Subject: Re: [PATCH v8 28/31] samples: add Rust examples

> Their types are different. One is for u8. The other is for UTF-8.

Yes, but:

  +#[derive(Debug, Default)]
  +struct ModuleInfo {
  +    type_: String,
  +    license: String,
  +    name: String,
  +    author: Option<String>,
  +    description: Option<String>,
  +    alias: Option<String>,
  +    params: Option<Group>,
  +}

  [...]

  +impl ModuleInfo {
  +    fn parse(it: &mut token_stream::IntoIter) -> Self {
  +            match key.as_str() {
  +                "type" => info.type_ = expect_ident(it),
  +                "name" => info.name = expect_byte_string(it),
  +                "author" => info.author = Some(expect_byte_string(it)),
  +                "description" => info.description = Some(expect_byte_string(it)),
  +                "license" => info.license = expect_byte_string(it),
  +                "alias" => info.alias = Some(expect_byte_string(it)),
  +                "alias_rtnl_link" => {
  +                    info.alias = Some(format!("rtnl-link-{}", expect_byte_string(it)))
  +                }
  +                "params" => info.params = Some(expect_group(it)),
  +                _ => panic!(
  +                    "Unknown key \"{}\". Valid keys are: {:?}.",
  +                    key, EXPECTED_KEYS
  +                ),
  +            }

In the the end all module parameters are String, so why not use &str in
the API?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ