From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <d.csapak@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 ABAC4613A7
 for <pbs-devel@lists.proxmox.com>; Fri, 18 Feb 2022 13:48:52 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id A9C6729B24
 for <pbs-devel@lists.proxmox.com>; Fri, 18 Feb 2022 13:48:52 +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 id 0682D29B09
 for <pbs-devel@lists.proxmox.com>; Fri, 18 Feb 2022 13:48:52 +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 D5101462B3
 for <pbs-devel@lists.proxmox.com>; Fri, 18 Feb 2022 13:48:51 +0100 (CET)
From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Date: Fri, 18 Feb 2022 13:48:49 +0100
Message-Id: <20220218124850.573252-3-d.csapak@proxmox.com>
X-Mailer: git-send-email 2.30.2
In-Reply-To: <20220218124850.573252-1-d.csapak@proxmox.com>
References: <20220218124850.573252-1-d.csapak@proxmox.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.157 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 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: [pbs-devel] [PATCH proxmox 2/2] proxmox-async: remove proxmox-sys
 dependency
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: Fri, 18 Feb 2022 12:48:52 -0000

by replacing the two uses of io_format_err and io_err_other

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 proxmox-async/Cargo.toml                     |  1 -
 proxmox-async/src/io/async_channel_writer.rs | 16 ++++++++++++----
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/proxmox-async/Cargo.toml b/proxmox-async/Cargo.toml
index c7f78cc..c4936ee 100644
--- a/proxmox-async/Cargo.toml
+++ b/proxmox-async/Cargo.toml
@@ -15,7 +15,6 @@ lazy_static = "1.4"
 pin-utils = "0.1.0"
 tokio = { version = "1.0", features = [ "net", "rt", "rt-multi-thread", "sync"] }
 
-proxmox-sys = { path = "../proxmox-sys", version = "0.2.0" }
 proxmox-io = { path = "../proxmox-io", version = "1", features = [ "tokio" ] }
 
 [dev-dependencies]
diff --git a/proxmox-async/src/io/async_channel_writer.rs b/proxmox-async/src/io/async_channel_writer.rs
index f63648a..cec1fb6 100644
--- a/proxmox-async/src/io/async_channel_writer.rs
+++ b/proxmox-async/src/io/async_channel_writer.rs
@@ -12,8 +12,6 @@ use tokio::io::AsyncWrite;
 use tokio::sync::mpsc::Sender;
 
 use proxmox_io::ByteBuffer;
-use proxmox_sys::error::io_err_other;
-use proxmox_sys::io_format_err;
 
 /// Wrapper around tokio::sync::mpsc::Sender, which implements Write
 pub struct AsyncChannelWriter {
@@ -63,7 +61,12 @@ impl AsyncChannelWriter {
 
                     let sender = match self.sender.take() {
                         Some(sender) => sender,
-                        None => return Poll::Ready(Err(io_err_other("no sender"))),
+                        None => {
+                            return Poll::Ready(Err(std::io::Error::new(
+                                std::io::ErrorKind::Other,
+                                "no sender",
+                            )))
+                        }
                     };
 
                     let data = self.buf.remove_data(self.buf.len()).to_vec();
@@ -72,7 +75,12 @@ impl AsyncChannelWriter {
                             .send(Ok(data))
                             .await
                             .map(move |_| sender)
-                            .map_err(|err| io_format_err!("could not send: {}", err))
+                            .map_err(|err| {
+                                std::io::Error::new(
+                                    std::io::ErrorKind::Other,
+                                    format!("could not send: {}", err),
+                                )
+                            })
                     };
 
                     self.state = WriterState::Sending(future.boxed());
-- 
2.30.2