]> git.proxmox.com Git - proxmox-backup.git/blobdiff - src/bin/sg-tape-cmd.rs
Set MMAP_THRESHOLD to a fixed value (128K)
[proxmox-backup.git] / src / bin / sg-tape-cmd.rs
index f8508176a16fba390a5ebaaf325bc32c560a2ba9..7edfe5c57644e8e652dfcd3c6b8182a82d61c169 100644 (file)
@@ -9,28 +9,23 @@ use std::os::unix::io::{AsRawFd, FromRawFd};
 use anyhow::{bail, Error};
 use serde_json::Value;
 
-use proxmox::{
-    api::{
-        api,
-        cli::*,
-        RpcEnvironment,
-    },
-    tools::Uuid,
-};
+use proxmox_router::{cli::*, RpcEnvironment};
+use proxmox_schema::api;
+use proxmox_uuid::Uuid;
 
 use pbs_api_types::{
     Fingerprint, LTO_DRIVE_PATH_SCHEMA, DRIVE_NAME_SCHEMA, TAPE_ENCRYPTION_KEY_FINGERPRINT_SCHEMA,
     MEDIA_SET_UUID_SCHEMA, LtoTapeDrive,
 };
 
+use pbs_tape::linux_list_drives::{open_lto_tape_device, check_tape_is_lto_tape_device};
+
 use proxmox_backup::{
     tape::{
         drive::{
             TapeDriver,
             LtoTapeHandle,
-            open_lto_tape_device,
             open_lto_tape_drive,
-            check_tape_is_lto_tape_device,
         },
     },
 };
@@ -39,12 +34,12 @@ fn get_tape_handle(param: &Value) -> Result<LtoTapeHandle, Error> {
 
     let handle = if let Some(name) = param["drive"].as_str() {
         let (config, _digest) = pbs_config::drive::config()?;
-        let drive: LtoTapeDrive = config.lookup("lto", &name)?;
+        let drive: LtoTapeDrive = config.lookup("lto", name)?;
         eprintln!("using device {}", drive.path);
         open_lto_tape_drive(&drive)?
     } else if let Some(device) = param["device"].as_str() {
         eprintln!("using device {}", device);
-        LtoTapeHandle::new(open_lto_tape_device(&device)?)?
+        LtoTapeHandle::new(open_lto_tape_device(device)?)?
     } else if let Some(true) = param["stdin"].as_bool() {
         eprintln!("using stdin");
         let fd = std::io::stdin().as_raw_fd();
@@ -67,7 +62,7 @@ fn get_tape_handle(param: &Value) -> Result<LtoTapeHandle, Error> {
 
         if drive_names.len() == 1 {
             let name = drive_names[0];
-            let drive: LtoTapeDrive = config.lookup("lto", &name)?;
+            let drive: LtoTapeDrive = config.lookup("lto", name)?;
             eprintln!("using device {}", drive.path);
             open_lto_tape_drive(&drive)?
         } else {
@@ -112,7 +107,7 @@ fn set_encryption(
     param: Value,
 ) -> Result<(), Error> {
 
-    let result = proxmox::try_block!({
+    let result = proxmox_lang::try_block!({
         let mut handle = get_tape_handle(&param)?;
 
         match (fingerprint, uuid) {