tape: silence some warnings
Nightly rustc now warns about unused private fields in the case of a non-pub newtype struct, so use an underscore-prefixed dummy field name to get rid of the warning. Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
9230e40e35
commit
1565ff951e
@ -44,12 +44,14 @@ pub fn backup_group() -> Result<nix::unistd::Group, Error> {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct BackupLockGuard(Option<std::fs::File>);
|
||||
pub struct BackupLockGuard {
|
||||
_file: Option<std::fs::File>,
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
/// Note: do not use for production code, this is only intended for tests
|
||||
pub unsafe fn create_mocked_lock() -> BackupLockGuard {
|
||||
BackupLockGuard(None)
|
||||
BackupLockGuard { _file: None }
|
||||
}
|
||||
|
||||
/// Open or create a lock file owned by user "backup" and lock it.
|
||||
@ -73,7 +75,7 @@ pub fn open_backup_lockfile<P: AsRef<std::path::Path>>(
|
||||
let timeout = timeout.unwrap_or(std::time::Duration::new(10, 0));
|
||||
|
||||
let file = proxmox_sys::fs::open_file_locked(&path, timeout, exclusive, options)?;
|
||||
Ok(BackupLockGuard(Some(file)))
|
||||
Ok(BackupLockGuard { _file: Some(file) })
|
||||
}
|
||||
|
||||
/// Atomically write data to file owned by "root:backup" with permission "0640"
|
||||
|
@ -592,7 +592,9 @@ fn tape_device_path(config: &SectionConfigData, drive: &str) -> Result<String, E
|
||||
}
|
||||
}
|
||||
|
||||
pub struct DeviceLockGuard(std::fs::File);
|
||||
pub struct DeviceLockGuard {
|
||||
_file: std::fs::File,
|
||||
}
|
||||
|
||||
// Uses systemd escape_unit to compute a file name from `device_path`, the try
|
||||
// to lock `/var/lock/<name>`.
|
||||
@ -630,7 +632,7 @@ fn lock_device_path(device_path: &str) -> Result<DeviceLockGuard, TapeLockError>
|
||||
}
|
||||
}
|
||||
|
||||
Ok(DeviceLockGuard(file))
|
||||
Ok(DeviceLockGuard { _file: file })
|
||||
}
|
||||
|
||||
// Same logic as lock_device_path, but uses a timeout of 0, making it
|
||||
|
Loading…
Reference in New Issue
Block a user