From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <l.wagner@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id 3F063C19FD
 for <pbs-devel@lists.proxmox.com>; Wed, 17 Jan 2024 10:51:02 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 2261A3FEB1
 for <pbs-devel@lists.proxmox.com>; Wed, 17 Jan 2024 10:50:32 +0100 (CET)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [94.136.29.106])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS
 for <pbs-devel@lists.proxmox.com>; Wed, 17 Jan 2024 10:50:31 +0100 (CET)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id DA27049196
 for <pbs-devel@lists.proxmox.com>; Wed, 17 Jan 2024 10:50:30 +0100 (CET)
Message-ID: <5ce91b68-59a8-4ff7-a247-c433171e4451@proxmox.com>
Date: Wed, 17 Jan 2024 10:50:30 +0100
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
From: Lukas Wagner <l.wagner@proxmox.com>
To: Proxmox Backup Server development discussion
 <pbs-devel@lists.proxmox.com>, Stefan Lendl <s.lendl@proxmox.com>
References: <20240111155303.1072675-1-s.lendl@proxmox.com>
 <20240111155303.1072675-11-s.lendl@proxmox.com>
Content-Language: de-AT, en-US
In-Reply-To: <20240111155303.1072675-11-s.lendl@proxmox.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL -0.004 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
 T_SCC_BODY_TEXT_LINE    -0.01 -
Subject: Re: [pbs-devel] [PATCH proxmox-backup 05/10] config: remove
 unnecessary pub in various methods in NetworkConfig
X-BeenThere: pbs-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox Backup Server development discussion
 <pbs-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pbs-devel/>
List-Post: <mailto:pbs-devel@lists.proxmox.com>
List-Help: <mailto:pbs-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Wed, 17 Jan 2024 09:51:02 -0000



On 1/11/24 16:53, Stefan Lendl wrote:
> Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
> ---
>   pbs-config/src/network/mod.rs    | 10 +++++-----
>   pbs-config/src/network/parser.rs |  2 +-
>   2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/pbs-config/src/network/mod.rs b/pbs-config/src/network/mod.rs
> index 971c1ebe..9ecc66b8 100644
> --- a/pbs-config/src/network/mod.rs
> +++ b/pbs-config/src/network/mod.rs
> @@ -251,7 +251,7 @@ impl NetworkConfig {
>       }
>   
>       /// Check if ports are used only once
> -    pub fn check_port_usage(&self) -> Result<(), Error> {
> +    fn check_port_usage(&self) -> Result<(), Error> {
>           let mut used_ports = HashMap::new();
>           let mut check_port_usage = |iface, ports: &Vec<String>| {
>               for port in ports.iter() {
> @@ -280,7 +280,7 @@ impl NetworkConfig {
>       }
>   
>       /// Check if child mtu is less or equal than parent mtu
> -    pub fn check_mtu(&self, parent_name: &str, child_name: &str) -> Result<(), Error> {
> +    fn check_mtu(&self, parent_name: &str, child_name: &str) -> Result<(), Error> {
>           let parent = self
>               .interfaces
>               .get(parent_name)
> @@ -320,7 +320,7 @@ impl NetworkConfig {
>       }
>   
>       /// Check if bond slaves exists
> -    pub fn check_bond_slaves(&self) -> Result<(), Error> {
> +    fn check_bond_slaves(&self) -> Result<(), Error> {
>           for (iface, interface) in self.interfaces.iter() {
>               if let Some(slaves) = &interface.slaves {
>                   for slave in slaves.iter() {
> @@ -348,7 +348,7 @@ impl NetworkConfig {
>       }
>   
>       /// Check if bridge ports exists
> -    pub fn check_bridge_ports(&self) -> Result<(), Error> {
> +    fn check_bridge_ports(&self) -> Result<(), Error> {
>           lazy_static! {
>               static ref VLAN_INTERFACE_REGEX: Regex = Regex::new(r"^(\S+)\.(\d+)$").unwrap();
>           }
> @@ -372,7 +372,7 @@ impl NetworkConfig {
>           Ok(())
>       }
>   
> -    pub fn write_config(&self, w: &mut dyn Write) -> Result<(), Error> {
> +    fn write_config(&self, w: &mut dyn Write) -> Result<(), Error> { >           self.check_port_usage()?;
>           self.check_bond_slaves()?;
>           self.check_bridge_ports()?;
> diff --git a/pbs-config/src/network/parser.rs b/pbs-config/src/network/parser.rs
> index 5a83e192..0c178d9b 100644
> --- a/pbs-config/src/network/parser.rs
> +++ b/pbs-config/src/network/parser.rs
> @@ -491,7 +491,7 @@ impl<R: BufRead> NetworkParser<R> {
>               .map_err(|err| format_err!("line {}: {}", self.line_nr, err))
>       }
>   
> -    pub fn _parse_interfaces(
> +    fn _parse_interfaces(

Maybe use this opportunity to name this method in a more idiomatic way?
The _ prefix is not really common in Rust ;)

>           &mut self,
>           existing_interfaces: Option<&HashMap<String, bool>>,
>       ) -> Result<NetworkConfig, Error> {

-- 
- Lukas