btrfs_cli/quota/
disable.rs1use crate::{Format, Runnable};
2use anyhow::{Context, Result};
3use clap::Parser;
4use std::{fs::File, os::unix::io::AsFd, path::PathBuf};
5
6#[derive(Parser, Debug)]
8pub struct QuotaDisableCommand {
9 pub path: PathBuf,
11}
12
13impl Runnable for QuotaDisableCommand {
14 fn run(&self, _format: Format, _dry_run: bool) -> Result<()> {
15 let file = File::open(&self.path).with_context(|| {
16 format!("failed to open '{}'", self.path.display())
17 })?;
18
19 btrfs_uapi::quota::quota_disable(file.as_fd()).with_context(|| {
20 format!("failed to disable quota on '{}'", self.path.display())
21 })?;
22
23 println!("quota disabled on '{}'", self.path.display());
24
25 Ok(())
26 }
27}